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