public function applyFilter(Image $image)
 {
     return $image->fit(150, 150, function ($contraint) {
     }, 'top');
 }
Beispiel #2
0
 /**
  * @param \Intervention\Image\Image $image
  *
  * @return void
  */
 public function run(Image $image)
 {
     $callback = function (Constraint $constraint) {
         $constraint->upsize();
     };
     $image->fit($this->width, $this->height, $callback, $this->position)->interlace($this->interlace);
 }
 /**
  * Applies filter effects to the given image
  *
  * @param Image\Image $image The image to filter.
  *
  * @return Image\Image The filtered image.
  */
 public function applyFilter(Image\Image $image)
 {
     $image->fit(100, 100, function ($constraint) {
         $constraint->upsize();
     });
     return $image;
 }
Beispiel #4
0
 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700, function ($constraint) {
         //$constraint->aspectRatio();
         //$constraint->upsize();
     })->encode('jpg', 70);
 }
 public function process(Image $image)
 {
     if ($this->request->query->has('fit') && !$this->request->query->has('width') && !$this->request->query->has('height') && 1 === preg_match('#^([0-9]+)[x\\:]([0-9]+)$#', $this->request->query->get('fit'), $fit)) {
         $image->fit($fit[1], $fit[2], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function process(\Intervention\Image\Image $image)
 {
     // Manipulate the image as required
     $image->fit(320, 240);
     // Optionally encode the manipulated image or let
     // imageRack encode it with the default values.
     // $image->encode();
     // Return the manipulated image
     return $image;
 }
Beispiel #7
0
 public function applyFilter(Image $image)
 {
     return $image->fit(1130, 430);
     //->greyscale()
     //->colorize(0, 10, 30)
     //->contrast(-25)
     //->brightness(-25)
     //->blur(50);
     //->gamma(3.5);
 }
 public function process(Image $image)
 {
     if ($this->request->query->has('crop') && 1 === preg_match('#^([0-9]+)[x\\:]([0-9]+)$#', $this->request->query->get('crop'), $crop) && ($this->request->query->has('width') || $this->request->query->has('height'))) {
         $fitRatio = (double) $crop[1] / (double) $crop[2];
         if ($this->request->query->has('width')) {
             $realFitSize = [(int) $this->request->query->get('width'), round($this->request->query->get('width') / $fitRatio)];
         } elseif ($this->request->query->has('height')) {
             $realFitSize = [round($this->request->query->get('height') * $fitRatio), (int) $this->request->query->get('height')];
         }
         $image->fit($realFitSize[0], $realFitSize[1], function (Constraint $constraint) {
             $constraint->upsize();
         });
     }
 }
Beispiel #9
0
 protected function fit()
 {
     if ($this->width !== null || $this->height !== null) {
         if ($this->fit === self::FIT_CROP && $this->width && $this->height) {
             $this->image->fit($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
             });
             return;
         }
         if ($this->fit === self::FIT_MIN || $this->fit === self::FIT_MAX) {
             if ($this->fit === self::FIT_MAX) {
                 $this->image->resize($this->width, $this->height, function ($constraint) {
                     /* @var $constraint \Intervention\Image\Constraint */
                     $constraint->aspectRatio();
                     $constraint->upsize();
                 });
                 $this->image->resizeCanvas($this->width, $this->height, 'top-left');
             }
             if ($this->fit === self::FIT_MIN) {
                 $height = $this->image->getHeight() < $this->height ? $this->image->getHeight() : $this->height;
                 $width = $this->image->getWidth() < $this->width ? $this->image->getWidth() : $this->width;
                 $this->image->fit($width, $height, function ($constraint) {
                     /* @var $constraint \Intervention\Image\Constraint */
                     $constraint->aspectRatio();
                     $constraint->upsize();
                 });
             }
             return;
         }
         if ($this->fit === self::FIT_CLIP) {
             $this->image->resize($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
                 $constraint->upsize();
             });
             return;
         }
         if ($this->fit === self::FIT_SCALE) {
             $this->image->resize($this->width, $this->height);
             return;
         }
         if ($this->fit === self::FIT_CLAMP) {
             $this->image->resize($this->width, $this->height, function ($constraint) {
                 /* @var $constraint \Intervention\Image\Constraint */
                 $constraint->aspectRatio();
             });
         }
     }
 }
Beispiel #10
0
 public function applyFilter(Image $image)
 {
     return $image->fit(480, 320);
 }
Beispiel #11
0
 public function applyFilter(Image $image)
 {
     return $image->fit(480, 360)->insert(storage_path('app/public/wm-large.png'), 'bottom-right', 5, 5);
 }
 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700)->contrast(-15)->brightness(15)->gamma(2);
 }
Beispiel #13
0
 /**
  * Applies filter to given image
  *
  * @param  \Intervention\Image\Image $image
  *
  * @return \Intervention\Image\Image
  */
 public function applyFilter(\Intervention\Image\Image $image)
 {
     // TODO: Implement applyFilter() method.
     return $image->fit(900, 475);
 }
Beispiel #14
0
 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700)->greyscale()->blur(30)->contrast(-60)->brightness(-30);
 }
Beispiel #15
0
 public function applyFilter(Image $image)
 {
     return $image->fit(500, 375);
 }
Beispiel #16
0
 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 700)->greyscale()->blur(50)->gamma(3.5);
 }
Beispiel #17
0
 public function applyFilter(Image $image)
 {
     return $image->fit(240, 180)->insert(storage_path('app/public/wm-medium.png'), 'bottom-right', 5, 5);
 }
 public function applyFilter(Image $image)
 {
     return $image->fit(900, 700);
 }
 public function applyFilter(Image $image)
 {
     return $image->fit(1400, 300)->greyscale()->colorize(0, 0, 10);
 }
Beispiel #20
0
 public function applyFilter(Image $image)
 {
     return $image->fit(120, 120, function ($constraint) {
         $constraint->aspectRatio();
     });
 }
Beispiel #21
0
 /**
  * Make image into preview.
  *
  * @param  \Intervention\Image\Image $image
  * @return \Intervention\Image\Image
  */
 private function makePreview($image)
 {
     $image->fit(320, 180);
     $image->blur(5);
     return $image;
 }
Beispiel #22
0
 /**
  * Perform crop resize image manipulation.
  * @param  Image  $image  The source image.
  * @param  string $width  The width.
  * @param  string $height The height.
  * @param  string $crop   The crop.
  * @return Image  The manipulated image.
  */
 public function runCropResize(Image $image, $width, $height, $crop)
 {
     return $image->fit($width, $height, function () {
     }, $crop);
 }
Beispiel #23
0
 public function applyFilter(Image $image)
 {
     // prevent possible upsizing
     return $image->fit(16, 16);
 }
Beispiel #24
0
 public function applyFilter(Image $image)
 {
     return $image->fit(640, 480);
 }
 public function applyFilter(Image $image)
 {
     return $image->fit(120, 90);
 }
Beispiel #26
0
 /**
  * @param $width
  * @param null   $height
  * @param string $position top-left|top|top-right|left|center|right|bottom-left|bottom|bottom-right
  *
  * @return $this
  */
 public function fit($width, $height = null, $position = 'center')
 {
     $this->image->fit($width, $height, null, $position);
     return $this;
 }
Beispiel #27
0
 public function applyFilter(Image $image)
 {
     return $image->fit('1000x750');
 }
 /**
  * @param Image $image
  * @param array $options
  * @return Image
  */
 public function process(Image $image, array $options)
 {
     return $image->fit($options['box'][0], $options['box'][1]);
 }
Beispiel #29
0
 public function applyFilter(Image $image)
 {
     return $image->fit(480, 480)->brightness(-35);
 }
Beispiel #30
0
 public function applyFilter(Image $image)
 {
     return $image->fit(491, 293);
 }