Ejemplo n.º 1
0
 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)
 {
     $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)
 {
     $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());
 }
Ejemplo n.º 6
0
 function apply(lmbAbstractImageContainer $container)
 {
     list($x, $y, $width, $height) = $this->calculateCropArea($container->getWidth(), $container->getHeight());
     $container->getResource()->cropImage($width, $height, $x, $y);
 }