public function process(Image $image)
 {
     if ($this->request->query->has('width') && 1 === preg_match('#^([0-9]+)$#', $this->request->query->get('width'), $width)) {
         $image->widen($width[1], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
예제 #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);
 }
예제 #3
0
 public function applyFilter(Image $image)
 {
     return $image->widen(640)->crop(640, 420);
 }
예제 #4
0
 public function applyFilter(Image $image)
 {
     return $image->widen(800);
 }
예제 #5
0
 /**
  * Resize image to new width, constraining proportions
  *
  * @param integer $width
  * @return \Intervention\Image\Image 
  * @static 
  */
 public static function widen($width)
 {
     return \Intervention\Image\Image::widen($width);
 }
예제 #6
0
 public function applyFilter(Image $image)
 {
     return $image->widen(Config::get('builder::watermark.width'))->insert(Config::get("builder::watermark.path_watermark"), Config::get("builder::watermark.position"), Config::get("builder::watermark.x"), Config::get("builder::watermark.y"));
 }
예제 #7
0
파일: Widen.php 프로젝트: Houbsi/Media
 /**
  * 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->widen($options['width'], $callback);
 }