本文整理匯總了PHP中Media_Model::handleUpload方法的典型用法代碼示例。如果您正苦於以下問題:PHP Media_Model::handleUpload方法的具體用法?PHP Media_Model::handleUpload怎麽用?PHP Media_Model::handleUpload使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Media_Model
的用法示例。
在下文中一共展示了Media_Model::handleUpload方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
case 2:
$model = new Layout_Model();
if (!empty($_POST)) {
if ($model->deleteGallery($_POST['pictureId'])) {
echo 1;
}
}
break;
case 3:
$model = new Layout_Model();
$allowedExtensions = array("jpg", "JPG", "jpeg", "png");
$sizeLimit = 20 * 1024 * 1024;
$uploader = new Media_Model($allowedExtensions, $sizeLimit);
$savePath = $root . '/images/media/original/';
$medium = $root . '/images/media/thumb/';
$pre = 'Villa-Aqua-' . Tools::slugify($_POST['sectionName']);
$mediumWidth = 550;
if ($result = $uploader->handleUpload($savePath, $pre)) {
$uploader->getThumb($result['fileName'], $savePath, $medium, $mediumWidth, 'width', '');
$newData = getimagesize($medium . $result['fileName']);
$wp = $newData[0];
$hp = $newData[1];
$lastId = 0;
if ($newData) {
$lastId = $model->addGallery($_POST['sectionName'], $result['fileName']);
}
$data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId);
echo htmlspecialchars(json_encode($data), ENT_NOQUOTES);
}
break;
}