Exemplo n.º 1
0
 protected function _resize($width, $height = null, $keepar = true, $pad = true)
 {
     extract(parent::_resize($width, $height, $keepar, $pad));
     $image = '"' . $this->image_temp . '"';
     $this->exec('convert', "-define png:size=" . $cwidth . "x" . $cheight . " " . $image . " " . "-background none " . "-resize \"" . ($pad ? $width : $cwidth) . "x" . ($pad ? $height : $cheight) . "!\" " . "-gravity center " . "-extent " . $cwidth . "x" . $cheight . " " . $image);
     $this->clear_sizes();
 }
Exemplo n.º 2
0
 protected function _resize($width, $height = null, $keepar = true, $pad = true)
 {
     extract(parent::_resize($width, $height, $keepar, $pad));
     $sizes = $this->sizes();
     $this->debug("Resizing image to {$width}, {$height} with" . ($keepar ? '' : 'out') . " keeping AR and with" . ($pad ? '' : 'out') . " padding.");
     // Add the original image.
     $image = $this->create_transparent_image($cwidth, $cheight);
     call_user_func($this->gdresizefunc, $image, $this->image_data, $x, $y, 0, 0, $width, $height, $sizes->width, $sizes->height);
     $this->image_data = $image;
 }
Exemplo n.º 3
0
 protected function _resize($width, $height = null, $keepar = true, $pad = true)
 {
     extract(parent::_resize($width, $height, $keepar, $pad));
     $this->imagick->scaleImage($width, $height, $keepar);
     if ($pad) {
         $tmpimage = new \Imagick();
         $tmpimage->newImage($cwidth, $cheight, $this->create_color('#000', 0), 'png');
         $tmpimage->compositeImage($this->imagick, \Imagick::COMPOSITE_DEFAULT, ($cwidth - $width) / 2, ($cheight - $height) / 2);
         $this->imagick = $tmpimage;
     }
 }