コード例 #1
0
ファイル: Image.php プロジェクト: vescoyez/portfolio_v2
 /**
  * Re-sizes the image. If $height is not specified, it will default to $width, creating a square.
  *
  * @param int      $targetWidth
  * @param int|null $targetHeight
  *
  * @return Image
  */
 public function resize($targetWidth, $targetHeight = null)
 {
     $this->normalizeDimensions($targetWidth, $targetHeight);
     if ($this->_isAnimatedGif) {
         $this->_image->layers()->coalesce();
         // Create a new image instance to avoid object references messing up our dimensions.
         $newSize = new \Imagine\Image\Box($targetWidth, $targetHeight);
         $gif = $this->_instance->create($newSize);
         $gif->layers()->remove(0);
         foreach ($this->_image->layers() as $layer) {
             $resizedLayer = $layer->resize($newSize, $this->_getResizeFilter());
             $gif->layers()->add($resizedLayer);
             // Let's update dateUpdated in case this is going to take awhile.
             if ($index = craft()->assetTransforms->getActiveTransformIndexModel()) {
                 craft()->assetTransforms->storeTransformIndexData($index);
             }
         }
         $this->_image = $gif;
     } else {
         if (craft()->images->isImagick()) {
             $this->_image->smartResize(new \Imagine\Image\Box($targetWidth, $targetHeight), (bool) craft()->config->get('preserveImageColorProfiles'), $this->_quality);
         } else {
             $this->_image->resize(new \Imagine\Image\Box($targetWidth, $targetHeight), $this->_getResizeFilter());
         }
     }
     return $this;
 }
コード例 #2
0
ファイル: Image.php プロジェクト: harish94/Craft-Release
	/**
	 * Re-sizes the image. If $height is not specified, it will default to $width, creating a square.
	 *
	 * @param int      $targetWidth
	 * @param int|null $targetHeight
	 *
	 * @return Image
	 */
	public function resize($targetWidth, $targetHeight = null)
	{
		$this->_normalizeDimensions($targetWidth, $targetHeight);

		if ($this->_isAnimatedGif)
		{

			// Create a new image instance to avoid object references messing up our dimensions.
			$newSize = new \Imagine\Image\Box($targetWidth, $targetHeight);
			$gif = $this->_instance->create($newSize);
			$gif->layers()->remove(0);

			foreach ($this->_image->layers() as $layer)
			{
				$resizedLayer = $layer->resize($newSize, $this->_getResizeFilter());
				$gif->layers()->add($resizedLayer);
			}

			$this->_image = $gif;
		}
		else
		{
			$this->_image->resize(new \Imagine\Image\Box($targetWidth, $targetHeight), $this->_getResizeFilter());
		}

		return $this;
	}
コード例 #3
0
ファイル: Editor.php プロジェクト: fraym/core
 /**
  * @return null|string
  */
 public function imageResize()
 {
     $this->openImage();
     $width = $this->imageWidth;
     $height = $this->imageHeight;
     $maxWidth = $this->imageMaxWidth;
     $maxHeight = $this->imageMaxHeight;
     if ($maxWidth === null && $maxHeight !== null) {
         $imageBox = $this->image->getSize()->heighten($maxHeight);
     } elseif ($maxHeight === null && $maxWidth !== null) {
         $imageBox = $this->image->getSize()->widen($maxWidth);
     } elseif ($maxHeight !== null && $maxWidth !== null) {
         $imageBox = $this->image->getSize()->heighten($maxHeight)->widen($maxWidth);
     } elseif ($width !== null && $height !== null) {
         $imageBox = new \Imagine\Image\Box($width, $height);
     } elseif ($width === null && $height !== null) {
         $imageBox = new \Imagine\Image\Box($this->image->getSize()->getWidth(), $height);
     } elseif ($width !== null && $height === null) {
         $imageBox = new \Imagine\Image\Box($width, $this->image->getSize()->getHeight());
     } else {
         $imageBox = new \Imagine\Image\Box($this->image->getSize()->getWidth(), $this->image->getSize()->getHeight());
     }
     $this->image = $this->image->resize($imageBox);
     return $this;
 }
コード例 #4
0
ファイル: Resize.php プロジェクト: x000000/storage-manager
 public function apply(ImageInterface &$image, ImagineInterface $imagine)
 {
     $box = $image->getSize();
     $width = Helper::percentValue($this->_width, $box->getWidth());
     $height = Helper::percentValue($this->_height, $box->getHeight());
     // no upscale
     if ($box->getWidth() <= $width && $box->getHeight() <= $height) {
         return;
     }
     Helper::scaleSize($width, $height, $box);
     $image->resize(new Box($width, $height));
 }
コード例 #5
0
 /**
  * Performs resize of the image. Imagine component is used.
  *
  * @param ImageInterface $imagine
  * @param                $resize
  * @param bool           $crop
  *
  * @return BoxInterface
  */
 private function performResize($imagine, $resize, $crop = true)
 {
     $box = $imagine->getSize();
     list($width, $height) = Utils::getDimension($resize);
     $box = $box->scale(max($width / $box->getWidth(), $height / $box->getHeight()));
     $imagine->resize($box);
     if ($crop) {
         $point = new Point(($box->getWidth() - $width) / 2, ($box->getHeight() - $height) / 2);
         $imagine->crop($point, new Box($width, $height));
     }
     return $box;
 }
コード例 #6
0
 /**
  * Command image resize
  * 
  * @param int $width
  * @param int $height
  * 
  * @return void
  */
 protected function imageResize($width, $height)
 {
     $width = (int) $width;
     $height = (int) $height;
     if ($width <= 0) {
         throw new BadMethodCallException('Invalid parameter width for command "resize"');
     }
     if ($height <= 0) {
         throw new BadMethodCallException('Invalid parameter height for command "resize"');
     }
     $this->image->resize(new Box($width, $height));
 }
コード例 #7
0
ファイル: ResizeCommand.php プロジェクト: ollietb/sulu
 /**
  * {@inheritdoc}
  */
 public function execute(ImageInterface &$image, $parameters)
 {
     $size = $image->getSize();
     $retina = isset($parameters['retina']) && $parameters['retina'] != 'false' ? 2 : 1;
     $newWidth = isset($parameters['x']) ? intval($parameters['x']) * $retina : null;
     $newHeight = isset($parameters['y']) ? intval($parameters['y']) * $retina : null;
     if ($newHeight == null) {
         $newHeight = $size->getHeight() / $size->getWidth() * $newWidth;
     }
     if ($newWidth == null) {
         $newWidth = $size->getWidth() / $size->getHeight() * $newHeight;
     }
     $image->resize(new Box($newWidth, $newHeight));
 }
コード例 #8
0
 /**
  * Re-sizes the image. If $height is not specified, it will default to $width, creating a square.
  *
  * @param int      $targetWidth
  * @param int|null $targetHeight
  *
  * @return Image
  */
 public function resize($targetWidth, $targetHeight = null)
 {
     $this->normalizeDimensions($targetWidth, $targetHeight);
     if ($this->_isAnimatedGif) {
         // Create a new image instance to avoid object references messing up our dimensions.
         $newSize = new \Imagine\Image\Box($targetWidth, $targetHeight);
         $gif = $this->_instance->create($newSize);
         $gif->layers()->remove(0);
         foreach ($this->_image->layers() as $layer) {
             $resizedLayer = $layer->resize($newSize, $this->_getResizeFilter());
             $gif->layers()->add($resizedLayer);
         }
         $this->_image = $gif;
     } else {
         if (craft()->images->isImagick()) {
             $this->_image->smartResize(new \Imagine\Image\Box($targetWidth, $targetHeight), (bool) craft()->config->get('preserveImageColorProfiles'), $this->_quality);
         } else {
             $this->_image->resize(new \Imagine\Image\Box($targetWidth, $targetHeight), $this->_getResizeFilter());
         }
     }
     return $this;
 }
コード例 #9
0
ファイル: Image.php プロジェクト: vigourouxjulien/thelia
 /**
  * Process image resizing, with borders or cropping. If $dest_width and $dest_height
  * are both null, no resize is performed.
  *
  * @param  ImagineInterface $imagine     the Imagine instance
  * @param  ImageInterface   $image       the image to process
  * @param  int              $dest_width  the required width
  * @param  int              $dest_height the required height
  * @param  int              $resize_mode the resize mode (crop / bands / keep image ratio)p
  * @param  string           $bg_color    the bg_color used for bands
  * @param  bool             $allow_zoom  if true, image may be zoomed to matchrequired size. If false, image is not zoomed.
  * @return ImageInterface   the resized image.
  */
 protected function applyResize(ImagineInterface $imagine, ImageInterface $image, $dest_width, $dest_height, $resize_mode, $bg_color, $allow_zoom = false)
 {
     if (!(is_null($dest_width) && is_null($dest_height))) {
         $width_orig = $image->getSize()->getWidth();
         $height_orig = $image->getSize()->getHeight();
         $ratio = $width_orig / $height_orig;
         if (is_null($dest_width)) {
             $dest_width = $dest_height * $ratio;
         }
         if (is_null($dest_height)) {
             $dest_height = $dest_width / $ratio;
         }
         if (is_null($resize_mode)) {
             $resize_mode = self::KEEP_IMAGE_RATIO;
         }
         $width_diff = $dest_width / $width_orig;
         $height_diff = $dest_height / $height_orig;
         $delta_x = $delta_y = $border_width = $border_height = 0;
         if ($width_diff > 1 && $height_diff > 1) {
             $resize_width = $width_orig;
             $resize_height = $height_orig;
             // When cropping, be sure to always generate an image which is
             //  no smaller than the required size, zooming it if required.
             if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
                 if ($allow_zoom) {
                     if ($width_diff > $height_diff) {
                         $resize_width = $dest_width;
                         $resize_height = intval($height_orig * $dest_width / $width_orig);
                         $delta_y = ($resize_height - $dest_height) / 2;
                     } else {
                         $resize_height = $dest_height;
                         $resize_width = intval($width_orig * $resize_height / $height_orig);
                         $delta_x = ($resize_width - $dest_width) / 2;
                     }
                 } else {
                     // No zoom : final image may be smaller than the required size.
                     $dest_width = $resize_width;
                     $dest_height = $resize_height;
                 }
             }
         } elseif ($width_diff > $height_diff) {
             // Image height > image width
             $resize_height = $dest_height;
             $resize_width = intval($width_orig * $resize_height / $height_orig);
             if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
                 $resize_width = $dest_width;
                 $resize_height = intval($height_orig * $dest_width / $width_orig);
                 $delta_y = ($resize_height - $dest_height) / 2;
             } elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
                 $dest_width = $resize_width;
             }
         } else {
             // Image width > image height
             $resize_width = $dest_width;
             $resize_height = intval($height_orig * $dest_width / $width_orig);
             if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
                 $resize_height = $dest_height;
                 $resize_width = intval($width_orig * $resize_height / $height_orig);
                 $delta_x = ($resize_width - $dest_width) / 2;
             } elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
                 $dest_height = $resize_height;
             }
         }
         $image->resize(new Box($resize_width, $resize_height));
         if ($resize_mode == self::EXACT_RATIO_WITH_BORDERS) {
             $border_width = intval(($dest_width - $resize_width) / 2);
             $border_height = intval(($dest_height - $resize_height) / 2);
             $canvas = new Box($dest_width, $dest_height);
             return $imagine->create($canvas, $bg_color)->paste($image, new Point($border_width, $border_height));
         } elseif ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
             $image->crop(new Point($delta_x, $delta_y), new Box($dest_width, $dest_height));
         }
     }
     return $image;
 }
コード例 #10
0
 /**
  * @param ImageInterface $image
  * @param $requestHeight
  */
 protected function resizeImageByHeight($image, $requestHeight)
 {
     $imageSizeBox = $image->getSize();
     $resizeBox = $imageSizeBox->heighten($requestHeight);
     $image->resize($resizeBox);
 }
コード例 #11
0
ファイル: Image.php プロジェクト: alex63530/thelia
 /**
  * Process image resizing, with borders or cropping. If $dest_width and $dest_height
  * are both null, no resize is performed.
  *
  * @param  ImagineInterface $imagine     the Imagine instance
  * @param  ImageInterface   $image       the image to process
  * @param  int              $dest_width  the required width
  * @param  int              $dest_height the required height
  * @param  int              $resize_mode the resize mode (crop / bands / keep image ratio)p
  * @param  string           $bg_color    the bg_color used for bands
  * @return ImageInterface   the resized image.
  */
 protected function applyResize(ImagineInterface $imagine, ImageInterface $image, $dest_width, $dest_height, $resize_mode, $bg_color)
 {
     if (!(is_null($dest_width) && is_null($dest_height))) {
         $width_orig = $image->getSize()->getWidth();
         $height_orig = $image->getSize()->getHeight();
         if (is_null($dest_width)) {
             $dest_width = $width_orig;
         }
         if (is_null($dest_height)) {
             $dest_height = $height_orig;
         }
         if (is_null($resize_mode)) {
             $resize_mode = self::KEEP_IMAGE_RATIO;
         }
         $width_diff = $dest_width / $width_orig;
         $height_diff = $dest_height / $height_orig;
         $delta_x = $delta_y = $border_width = $border_height = 0;
         if ($width_diff > 1 && $height_diff > 1) {
             $next_width = $width_orig;
             $next_height = $height_orig;
             $dest_width = $resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_width : $next_width;
             $dest_height = $resize_mode == self::EXACT_RATIO_WITH_BORDERS ? $dest_height : $next_height;
         } elseif ($width_diff > $height_diff) {
             // Image height > image width
             $next_height = $dest_height;
             $next_width = intval($width_orig * $next_height / $height_orig);
             if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
                 $next_width = $dest_width;
                 $next_height = intval($height_orig * $dest_width / $width_orig);
                 $delta_y = ($next_height - $dest_height) / 2;
             } elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
                 $dest_width = $next_width;
             }
         } else {
             // Image width > image height
             $next_width = $dest_width;
             $next_height = intval($height_orig * $dest_width / $width_orig);
             if ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
                 $next_height = $dest_height;
                 $next_width = intval($width_orig * $next_height / $height_orig);
                 $delta_x = ($next_width - $dest_width) / 2;
             } elseif ($resize_mode != self::EXACT_RATIO_WITH_BORDERS) {
                 $dest_height = $next_height;
             }
         }
         $image->resize(new Box($next_width, $next_height));
         if ($resize_mode == self::EXACT_RATIO_WITH_BORDERS) {
             $border_width = intval(($dest_width - $next_width) / 2);
             $border_height = intval(($dest_height - $next_height) / 2);
             $canvas = new Box($dest_width, $dest_height);
             return $imagine->create($canvas, $bg_color)->paste($image, new Point($border_width, $border_height));
         } elseif ($resize_mode == self::EXACT_RATIO_WITH_CROP) {
             $image->crop(new Point($delta_x, $delta_y), new Box($dest_width, $dest_height));
         }
     }
     return $image;
 }
コード例 #12
0
 /**
  * Resize an image to an exact width and height.
  *
  * @param  ImageInterface $image
  * @param  string $width - The image's new width.
  * @param  string $height - The image's new height.
  * @return ImageInterface
  */
 protected function resizeExact(ImageInterface $image, $width, $height)
 {
     return $image->resize(new Box($width, $height));
 }
コード例 #13
0
ファイル: FileUpload.php プロジェクト: Makeyko/galaxysss
 /**
  * Расширяет маленькую картинку по заданной стратегии
  *
  * @param \Imagine\Image\ImageInterface $image
  * @param int $widthFormat
  * @param int $heightFormat
  * @param int $mode
  *
  * @return \Imagine\Image\ImageInterface
  */
 protected static function expandImage($image, $widthFormat, $heightFormat, $mode)
 {
     $size = $image->getSize();
     $width = $size->getWidth();
     $height = $size->getHeight();
     if ($width < $widthFormat || $height < $heightFormat) {
         // расширяю картинку
         if ($mode == self::MODE_THUMBNAIL_CUT) {
             if ($width < $widthFormat && $height >= $heightFormat) {
                 $size = $size->widen($widthFormat);
             } else {
                 if ($width >= $widthFormat && $height < $heightFormat) {
                     $size = $size->heighten($heightFormat);
                 } else {
                     if ($width < $widthFormat && $height < $heightFormat) {
                         // определяю как расширять по ширине или по высоте
                         if ($width / $widthFormat < $height / $heightFormat) {
                             $size = $size->widen($widthFormat);
                         } else {
                             $size = $size->heighten($heightFormat);
                         }
                     }
                 }
             }
             $image->resize($size);
         } else {
             if ($width < $widthFormat && $height >= $heightFormat) {
                 $size = $size->heighten($heightFormat);
             } else {
                 if ($width >= $widthFormat && $height < $heightFormat) {
                     $size = $size->widen($widthFormat);
                 } else {
                     if ($width < $widthFormat && $height < $heightFormat) {
                         // определяю как расширять по ширине или по высоте
                         if ($width / $widthFormat < $height / $heightFormat) {
                             $size = $size->heighten($heightFormat);
                         } else {
                             $size = $size->widen($widthFormat);
                         }
                     }
                 }
             }
             $image->resize($size);
         }
     }
     return $image;
 }
コード例 #14
0
 /**
  * Save image
  * @return ImageInterface
  */
 public function save()
 {
     if (file_exists($this->_pathObjectFile)) {
         $this->_url = $this->_urlObjectFile;
         return true;
     } elseif (file_exists($this->_pathObjectFileOrigin)) {
         $this->_image = Image::getImagine()->open($this->_pathObjectFileOrigin);
     } elseif (file_exists($this->_pathObjectPlaceholder)) {
         $this->_url = $this->_urlObjectPlaceholder;
         return true;
     } elseif (file_exists($this->_pathObjectPlaceholderOrigin)) {
         $this->_image = Image::getImagine()->open($this->_pathObjectPlaceholderOrigin);
         $this->_pathObjectFile = $this->_pathObjectPlaceholder;
         $this->_urlObjectFile = $this->_urlObjectPlaceholder;
     } elseif (file_exists($this->_pathRootPlaceholder)) {
         $this->_url = $this->_urlRootPlaceholder;
         return true;
     } elseif (file_exists($this->_pathRootPlaceholderOrigin)) {
         $this->_image = Image::getImagine()->open($this->_pathRootPlaceholderOrigin);
         $this->_pathObjectFile = $this->_pathRootPlaceholder;
         $this->_urlObjectFile = $this->_urlRootPlaceholder;
     }
     if ($this->_image) {
         if (!$this->width || !$this->height) {
             $ratio = $this->_image->getSize()->getWidth() / $this->_image->getSize()->getHeight();
             if ($this->width) {
                 $this->height = ceil($this->width / $ratio);
             } else {
                 $this->width = ceil($this->height * $ratio);
             }
             $box = new Box($this->width, $this->height);
             $this->_image->resize($box);
             $this->_image->crop(new Point(0, 0), $box);
         } else {
             $box = new Box($this->width, $this->height);
             $size = $this->_image->getSize();
             if ($size->getWidth() <= $box->getWidth() && $size->getHeight() <= $box->getHeight() || !$box->getWidth() && !$box->getHeight()) {
             } else {
                 $this->_image = $this->_image->thumbnail($box, ManipulatorInterface::THUMBNAIL_OUTBOUND);
                 // calculate points
                 $size = $this->_image->getSize();
                 $startX = 0;
                 $startY = 0;
                 if ($size->getWidth() < $this->width) {
                     $startX = ceil($this->width - $size->getWidth()) / 2;
                 }
                 if ($size->getHeight() < $this->height) {
                     $startY = ceil($this->height - $size->getHeight()) / 2;
                 }
                 // create empty image to preserve aspect ratio of thumbnail
                 $thumb = Image::getImagine()->create($box, new Color('FFF', 100));
                 $thumb->paste($this->_image, new Point($startX, $startY));
                 $this->_image = $thumb;
             }
         }
         $this->_image->save($this->_pathObjectFile);
         $this->_url = $this->_urlObjectFile;
         return true;
     }
     return false;
 }
コード例 #15
0
ファイル: Resize.php プロジェクト: anillaogi016/zend-admin
 /**
  * {@inheritdoc}
  */
 public function apply(ImageInterface $image)
 {
     return $image->resize($this->size);
 }
コード例 #16
0
 /**
  * {@inheritDoc}
  */
 public function apply(ImageInterface $image)
 {
     return $image->resize(call_user_func(array($image->getSize(), $this->method), $this->parameter));
 }
コード例 #17
0
ファイル: Manipulator.php プロジェクト: fvilpoix/php-common
 protected static function doResize(ImageInterface $image, Box $box)
 {
     return $image->resize($box);
 }
コード例 #18
0
ファイル: Image.php プロジェクト: cookyii/module-media
 /**
  * Strict resize an image.
  *
  * For example,
  *
  * ~~~
  * $obj->resize($Image, 200, 200);
  * $obj->resize($Image, 150, 250, \Imagine\Image\ImageInterface::FILTER_UNDEFINED);
  * ~~~
  *
  * @param Imagine\Image\ImageInterface $Image the image
  * @param integer $width the resize width
  * @param integer $height the resize height
  * @param boolean $strict strict resize
  * @param string $filter
  * @return \Imagine\Image\ImageInterface
  */
 public static function resize($Image, $width, $height, $strict = false, $filter = Imagine\Image\ImageInterface::FILTER_UNDEFINED)
 {
     $size = $Image->getSize();
     if ($strict === false) {
         if ($width > $size->getWidth()) {
             $width = $size->getWidth();
         }
         if ($height > $size->getHeight()) {
             $height = $size->getHeight();
         }
     }
     return $Image->resize(new Imagine\Image\Box($width, $height), $filter);
 }
コード例 #19
0
 protected function operationResize(ImageInterface $image, int $width, int $height)
 {
     $image->resize(new Box($width, $height));
 }
コード例 #20
0
 /**
  * @param \Imagine\Image\ImageInterface $image
  * @param array $options
  * @return \Imagine\Image\ImageInterface
  */
 protected function applyResizeFilter(ImageInterface $image, $options)
 {
     // Defaults
     $size = new Box(120, 120);
     if (isset($options['size']) && count($options['size']) == 2) {
         list($width, $height) = $options['size'];
         $size = new Box($width, $height);
     }
     return $image->resize($size);
 }
コード例 #21
0
ファイル: Image.php プロジェクト: maddoger/yii2-imagecache
 /**
  * Resize an image.
  *
  * @param integer $width the new width
  * @param integer $height the new height
  * @param string $filter
  * @return static
  * @throws InvalidParamException if the `$start` parameter is invalid
  */
 public function resize($width, $height, $filter = ImageInterface::FILTER_UNDEFINED)
 {
     $this->image->resize(new Box($width, $height), $filter);
     return $this;
 }
コード例 #22
0
ファイル: MainPage.php プロジェクト: andrei2nikitin/quiz
 /**
  * Применяет эффект к изображению.
  * @param ImageInterface $Image
  * @param string $effect
  * @param string $additional
  * @return bool
  */
 private function applyEffect(ImageInterface $Image, $effect, $additional = null)
 {
     switch ($effect) {
         case 'resize':
             if (!isset($additional['width']) || !isset($additional['height'])) {
                 return false;
             }
             $Image->resize(new Box($additional['width'], $additional['height']));
             break;
         case 'origin':
             break;
         case 'negative':
             $Image->effects()->negative();
             break;
         case 'grayscale':
             $Image->effects()->grayscale();
             break;
         case 'sharpen':
             $Image->effects()->sharpen();
             break;
         case 'colorize':
             $Image->effects()->colorize($Image->palette()->color($additional));
             break;
         case 'gamma':
             $Image->effects()->gamma($additional);
             break;
         case 'blur':
             $Image->effects()->blur($additional);
             break;
         default:
             return false;
     }
     return true;
 }
コード例 #23
0
ファイル: ImageService.php プロジェクト: sdrech/example_quiz
 /**
  * @param \Imagine\Image\ImageInterface $image
  * @param array $commandOptions array('size' => ('width' => 123, 'height => 456))
  * @return \Imagine\Image\ImageInterface
  */
 protected function resizeCommand(\Imagine\Image\ImageInterface $image, array $commandOptions)
 {
     if (!isset($commandOptions['size'])) {
     }
     $dimensions = $this->parseBox($commandOptions['size']);
     return $image->resize($dimensions);
 }