/**
  * Command image blur
  * 
  * @param float $sigma
  * 
  * @return void
  */
 protected function imageBlur($sigma = 1)
 {
     $sigma = (double) $sigma;
     $this->image->effects()->blur($sigma);
 }
 public function load(ImageInterface $image, array $options = array())
 {
     $image->effects()->grayscale();
     return $image;
 }
Example #3
0
 /**
  * Применяет эффект к изображению.
  * @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;
 }
Example #4
0
 protected function operationBlur(ImageInterface $image, float $amount)
 {
     $image->effects()->blur($amount);
 }
Example #5
0
 /**
  * Apply colorize filter
  *
  * @param  ImageInterface	$image An image instance
  * @param  string			$color The hex value of the color
  * @return void
  */
 protected function filterColorize(ImageInterface $image, $color)
 {
     $color = $image->palette()->color($color);
     $image->effects()->colorize($color);
     return $image;
 }
 /**
  * @param \Imagine\Image\ImageInterface $image
  * @param array $options
  * @return \Imagine\Image\ImageInterface
  */
 protected function applyColorizeFilter(ImageInterface $image, $options)
 {
     if (isset($options['color'])) {
         $color = $image->palette()->color($options['color']);
         $image->effects()->colorize($color);
     }
     return $image;
 }
 /**
  * Применяет эффект к изображению.
  * @param ImageInterface $Image
  * @param string $effect
  * @param string $additional
  * @return bool
  */
 private function applyEffect(ImageInterface $Image, $effect, $additional = null)
 {
     switch ($effect) {
         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;
 }