本文整理汇总了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;
}