public function crop($x1, $y1, $x2, $y2)
 {
     $this->image_class->crop($x1, $y1, $x2, $y2);
     return $this;
 }
예제 #2
0
 /**
  * Crop image to dimensions
  *
  * @param string $imagePath
  * @param int $x1
  * @param int $y1
  * @param int $x2
  * @param int $y2
  * @throws \ImageTool\Model\ModelException
  */
 public function crop($imagePath, $x1, $y1, $x2, $y2)
 {
     try {
         $simpleImage = new SimpleImage($imagePath);
         $simpleImage->crop($x1, $y1, $x2, $y2)->save();
     } catch (Exception $e) {
         Log::get()->error('Failed to resize image.', $e);
         throw new ModelException('Failed to resize image.');
     }
 }