Пример #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']);
 }
Пример #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']);
 }
Пример #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);
 }
Пример #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']);
 }
Пример #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);
 }
Пример #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']);
 }
Пример #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);
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = array())
 {
     /** @var \Imagick $resource */
     $resource = $imanee->getResource()->getResource();
     return $resource->modulateimage(100, 0, 100);
 }
Пример #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());
 }
Пример #10
0
 public function testSetAndGetResource()
 {
     $resource = $this->getMockBuilder('Imanee\\ImageResource\\GDResource')->setMethods(['crop'])->getMock();
     $this->model->setResource($resource);
     $this->assertSame($resource, $this->model->getResource());
 }
Пример #11
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = array())
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     return imagefilter($resource, IMG_FILTER_GRAYSCALE);
 }
Пример #12
0
 /**
  * {@inheritdoc}
  */
 public function apply(Imanee $imanee, array $options = [])
 {
     /** @var resource $resource */
     $resource = $imanee->getResource()->getResource();
     imagefilter($resource, IMG_FILTER_GAUSSIAN_BLUR);
 }