Exemplo n.º 1
0
 /** @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"));
     }
 }
Exemplo n.º 2
0
 /**
  * @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']));
     }
 }
Exemplo n.º 3
0
 /**
  * @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);
 }