Example #1
1
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['threshold' => 80], $options);
     return $resource->sepiaToneImage($options['threshold']);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var \Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['radius' => 2, 'sigma' => 2], $options);
     return $resource->gaussianBlurImage($options['radius'], $options['sigma']);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     imagefilter($resource, IMG_FILTER_GRAYSCALE);
     imagefilter($resource, IMG_FILTER_COLORIZE, 100, 50, 0);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var \Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['brightness' => 100, 'saturation' => 50, 'hue' => 100], $options);
     return $resource->modulateimage($options['brightness'], $options['saturation'], $options['hue']);
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var \Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['color' => 'blue'], $options);
     return $resource->colorizeimage($options['color'], 1);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['brightness' => 50, 'contrast' => -10], $options);
     imagefilter($resource, IMG_FILTER_BRIGHTNESS, $options['brightness']);
     imagefilter($resource, IMG_FILTER_CONTRAST, $options['saturation']);
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     $options = array_merge(['color' => 'blue'], $options);
     $pixel = new GDPixel($options['color']);
     imagefilter($resource, IMG_FILTER_COLORIZE, $pixel->channelR, $pixel->channelG, $pixel->channelB);
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = array())
 {
     /** @var \Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     return $resource->modulateimage(100, 0, 100);
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public function compositeImage($image, $coordX, $coordY, $width = 0, $height = 0, $transparency = 0)
 {
     if (!is_object($image)) {
         $image = new Imanee($image, new GDResource());
     }
     if (!$image instanceof \Imanee\Imanee) {
         throw new \Exception('Object not supported. It must be an instance of Imanee');
     }
     if ($width and $height) {
         $dimensions = PixelMath::getBestFit($width, $height, $image->getWidth(), $image->getHeight());
         $width = $dimensions['width'];
         $height = $dimensions['height'];
     } else {
         $width = $image->getWidth();
         $height = $image->getHeight();
     }
     /* TODO: implement pixel per pixel transparency */
     return imagecopyresampled($this->getResource(), $image->getResource()->getResource(), $coordX, $coordY, 0, 0, $width, $height, $image->getWidth(), $image->getHeight());
 }
Example #10
0
 public function testSetAndGetResource()
 {
     $resource = $this->getMockBuilder('Imanee\\ImageResource\\GDResource')->setMethods(['crop'])->getMock();
     $this->model->setResource($resource);
     $this->assertSame($resource, $this->model->getResource());
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = array())
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     return imagefilter($resource, IMG_FILTER_GRAYSCALE);
 }
Example #12
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     imagefilter($resource, IMG_FILTER_GAUSSIAN_BLUR);
 }