Exemplo n.º 1
0
 $x1 = $_POST["x1"];
 $y1 = $_POST["y1"];
 $x2 = $_POST["x2"];
 $y2 = $_POST["y2"];
 $w = $_POST["w"];
 $h = $_POST["h"];
 //	print $y1;
 //	error_log(print_r($_POST,true));
 $im_crop = new ImageCrop($_SESSION["path"] . $_SESSION["uploaded_file"]);
 //Scale the image to the thumb_width set above
 $im_crop->setSave_scale($thumb_width / $w);
 $im_crop->setSave_name($thumb_name);
 $im_crop->setSave_width($w);
 $im_crop->setSave_height($h);
 $im_crop->setStart_width($x1);
 $im_crop->setStart_height($y1);
 if (!$im_crop->doResize()) {
     print_r($im_crop->getErrorMessage());
     exit;
 }
 $im_crop->setSave_scale(1);
 $im_crop->setSave_name($_SESSION["path"] . $_SESSION["uploaded_file"]);
 if (!$im_crop->doResize()) {
     print_r($im_crop->getErrorMessage());
     exit;
 }
 switch ($_SESSION["module"]) {
     case "category":
         $cat = new Category($_SESSION["id"]);
         $cat->setImage($_SESSION["uploaded_file"]);
         $cat->save();