public function process(Image $image)
 {
     if ($this->request->query->has('height') && 1 === preg_match('#^([0-9]+)$#', $this->request->query->get('height'), $height)) {
         $image->heighten($height[1], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
Beispiel #2
0
 /**
  * Scales an image to the given width and height while maintaining aspect ratio.
  *
  * The resulting image can be smaller for one or both target dimensions.
  *
  * @param int $width
  *   The target width, in pixels. This value is omitted then the scaling will
  *   based only on the height value.
  * @param int $height
  *   The target height, in pixels. This value is omitted then the scaling will
  *   based only on the width value.
  */
 public function scale($width = null, $height = null)
 {
     if ($width === null && $height === null) {
         throw new \LogicException('one of "width" or "height" must be set for "scale"');
     }
     if ($width !== null && $height !== null) {
         $this->resize($width, $height);
         return;
     }
     if ($width !== null) {
         $this->image->widen($width);
         return;
     }
     $this->image->heighten($height);
 }
Beispiel #3
0
 /**
  * Handle the image manipulation request
  * @param  \Intervention\Image\Image $image
  * @param  array                     $options
  * @return \Intervention\Image\Image
  */
 public function handle($image, $options)
 {
     $options = array_merge($this->defaults, $options);
     $callback = isset($options['callback']) ? $options['callback'] : null;
     return $image->heighten($options['height'], $callback);
 }
Beispiel #4
0
 /**
  * Resize image to new height, constraining proportions
  *
  * @param integer $height
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function heighten($height)
 {
     return \Intervention\Image\Image::heighten($height);
 }