/** @noinspection PhpUnusedPrivateMethodInspection */ private function crop() { $file = new Crop(["x" => $_POST['crop-x'], "y" => $_POST['crop-y'], "x1" => $_POST['crop-x1'], "y1" => $_POST['crop-y1'], "thumbwidth" => $_POST['type'] == "title" ? 970 : 150, "directory" => "../data/uploads/" . Cunity::get("settings")->getSetting("core.filesdir"), "prefix" => "cr_"]); $file->filter($_POST['crop-image']); if ($_POST['type'] == "title") { $_SESSION['user']->titleImage = $_POST['imageid']; } else { $_SESSION['user']->profileImage = $_POST['imageid']; } /** @noinspection PhpUndefinedMethodInspection */ if ($_SESSION['user']->save()) { header("Location: " . Url::convertUrl("index.php?m=profile")); } }
/** * @throws \Exception */ private function crop() { $file = new Crop(["x" => $_POST['crop-x'], "y" => $_POST['crop-y'], "x1" => $_POST['crop-x1'], "y1" => $_POST['crop-y1'], "thumbwidth" => 970, "directory" => "../data/uploads/" . Cunity::get("settings")->getSetting("core.filesdir"), "prefix" => "cr_"]); $file->filter($_POST['crop-image']); $events = new Events(); if ($events->updateEvent($_POST['eventid'], ["imageId" => $_POST['imageid']])) { header("Location: " . Url::convertUrl("index.php?m=events&action=" . $_POST['eventid'])); } }
/** * @param \Zend_Config $config * @param $destinationFile * @param $previewFile * @throws \Cunity\Core\Exception */ public function resize(\Zend_Config $config, $destinationFile, $previewFile) { $resizer = new Resize($config->images); $preview = new Resize($config->previewImages); $crop = new Crop(["thumbwidth" => "thumbnail", "directory" => "../data/uploads/" . Cunity::get("settings")->getSetting("core.filesdir"), "prefix" => "thumb_"]); $resizer->filter($destinationFile); $preview->filter($previewFile); $crop->filter($destinationFile); }