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)
 {
     $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)
 {
     $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);
 }