function apply(lmbAbstractImageContainer $container) { $width = $container->getWidth(); $height = $container->getHeight(); $wm_cont = new Imagick(); $wm_cont->readImage($this->getWaterMark()); list($x, $y) = $this->calcPosition($this->getX(), $this->getY(), $width, $height); $container->getResource()->compositeImage($wm_cont, Imagick::COMPOSITE_OVER, $x, $y, Imagick::CHANNEL_ALL); }
function apply(lmbAbstractImageContainer $container) { $src_w = $container->getWidth(); $src_h = $container->getHeight(); list($dst_w, $dst_h) = $this->calcNewSize($src_w, $src_h); $im = imagecreatetruecolor($dst_w, $dst_h); imagecopyresampled($im, $container->getResource(), 0, 0, 0, 0, $dst_w, $dst_h, $src_w, $src_h); $container->replaceResource($im); }
function apply(lmbAbstractImageContainer $container) { $src_w = $container->getWidth(); $src_h = $container->getHeight(); list($dst_w, $dst_h) = $this->calcNewSize($src_w, $src_h); $image = $container->getResource(); $image->thumbnailImage($dst_w, $dst_h, false); $container->replaceResource($image); }
function apply(lmbAbstractImageContainer $container) { $angle = $this->getAngle(); if (!$angle) { return; } $bgcolor = $this->colorArrayToStr($this->getBgColor()); $image = $container->getResource(); $image->rotateImage(new ImagickPixel($bgcolor), $angle); $container->replaceResource($image); }
function apply(lmbAbstractImageContainer $container) { $width = $container->getWidth(); $height = $container->getHeight(); $wm_cont = new lmbGdImageContainer(); $wm_cont->load($this->getWaterMark()); $wm_width = $this->getXCenter() ? $wm_cont->getWidth() : false; $wm_height = $this->getYCenter() ? $wm_cont->getHeight() : false; list($x, $y) = $this->calcPosition($this->getX(), $this->getY(), $width, $height, $wm_width, $wm_height); imagecopymerge($container->getResource(), $wm_cont->getResource(), $x, $y, 0, 0, $wm_cont->getWidth(), $wm_cont->getHeight(), 100 - $this->getOpacity()); }
function apply(lmbAbstractImageContainer $container) { $angle = $this->getAngle(); if (!$angle) { return; } $bgcolor = $this->getBgColor(); $cur_im = $container->getResource(); $bg = imagecolorallocate($cur_im, $bgcolor['red'], $bgcolor['green'], $bgcolor['blue']); $im = imagerotate($cur_im, $angle, $bg); $container->replaceResource($im); }
function setOutputType($type) { if ($type) { if (!self::supportSaveType($type)) { throw new lmbImageTypeNotSupportedException($type); } } parent::setOutputType($type); }
function apply(lmbAbstractImageContainer $container) { list($x, $y, $width, $height) = $this->calculateCropArea($container->getWidth(), $container->getHeight()); $im = $container->isPallete() ? imagecreate($width, $height) : imagecreatetruecolor($width, $height); imagecopy($im, $container->getResource(), 0, 0, $x, $y, $width, $height); $container->replaceResource($im); }
function apply(lmbAbstractImageContainer $container) { list($x, $y, $width, $height) = $this->calculateCropArea($container->getWidth(), $container->getHeight()); $container->getResource()->cropImage($width, $height, $x, $y); }