$data = $backend->loadBackend(); $allowedExtensions = array("jpg", "JPG", "jpeg", "png"); $sizeLimit = 20 * 1024 * 1024; $uploader = new Media_Model($allowedExtensions, $sizeLimit); $savePath = $root . '/img-up/main-gallery/original/'; $medium = $root . '/img-up/main-gallery/medium/'; $pre = Tools::slugify($data['appInfo']['siteName']); $mediumWidth = 880; 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->addSlider($result['fileName']); } $data = array('success' => true, 'fileName' => $result['fileName'], 'wp' => $wp, 'hp' => $hp, 'lastId' => $lastId); echo htmlspecialchars(json_encode($data), ENT_NOQUOTES); } break; // Crop // Crop case 2: $model = new Media_Model(); $data = $backend->loadBackend(); if (!empty($_POST)) { $dstWidth = 1070; $dstImageHeight = 370; $source = $root . 'img-up/main-gallery/original/' . $_POST['imgId']; $destination = $root . 'img-up/main-gallery/front/' . $_POST['imgId'];