Пример #1
0
 /**
  * Initialize a new virgin layer
  * 
  * @param integer $width
  * @param integer $height
  * @param string $backgroundColor
  * 
  * @return ImageWorkshopLayer
  */
 public static function initVirginLayer($width = 100, $height = 100, $backgroundColor = null)
 {
     $opacity = 0;
     if (null === $backgroundColor || $backgroundColor == 'transparent') {
         $opacity = 127;
         $backgroundColor = 'ffffff';
     }
     return new ImageWorkshopLayer(ImageWorkshopLib::generateImage($width, $height, $backgroundColor, $opacity));
 }
Пример #2
0
 /**
  * Resize the background of a layer
  *
  * @param integer $newWidth
  * @param integer $newHeight
  */
 public function resizeBackground($newWidth, $newHeight)
 {
     $oldWidth = $this->width;
     $oldHeight = $this->height;
     $this->width = $newWidth;
     $this->height = $newHeight;
     $virginLayoutImage = ImageWorkshopLib::generateImage($this->width, $this->height);
     imagecopyresampled($virginLayoutImage, $this->image, 0, 0, 0, 0, $this->width, $this->height, $oldWidth, $oldHeight);
     unset($this->image);
     $this->image = $virginLayoutImage;
 }