Esempio n. 1
0
 protected function run(array $args)
 {
     $images = $this->convertImageToResource();
     $size = $this->calculateImageSize($images);
     $bgColor = isset($args['bgColor']) ? $args['bgColor'] : '#FFFFFF';
     $alpha = isset($args['alpha']) ? $args['alpha'] : 0;
     $type = isset($args['type']) ? $args['type'] : IMAGETYPE_PNG;
     if (!$this->image || !$this->image) {
         $image = SimpleImage::create($size[0], $size[1], $bgColor, $alpha, $type);
         $this->setSimpleImage($image);
     } else {
         $bgWidth = $this->image->width();
         $bgHeight = $this->image->height();
         $width = $bgWidth > $size[0] ? $bgWidth : $size[0];
         $height = $bgHeight > $size[1] ? $bgHeight : $size[1];
         $this->image->resizeCanvas(false, $width, $height);
     }
     $x = (int) $this->padding[0];
     $y = isset($this->padding[1]) ? (int) $this->padding[1] : (int) $this->padding;
     foreach ($images as $im) {
         $this->image->merge($im, [$x, $y]);
         $y += imagesy($im) + $this->spacing;
     }
 }