public function generate() { $width = $this->_owner->getImageWidth(); $height = $this->_owner->getImageHeight(); $temp = new Canvas(); $temp->createImageTrueColor($width, $height); imagecopy($temp->image, $this->_owner->image, $this->_offset_x, $this->_offset_y, 0, 0, $width - $this->_offset_x, $height - $this->_offset_y); imagecopy($temp->image, $this->_owner->image, 0, 0, $width - $this->_offset_x, $height - $this->_offset_y, $this->_offset_x, $this->_offset_y); imagecopy($temp->image, $this->_owner->image, 0, $this->_offset_y, $width - $this->_offset_x, 0, $this->_offset_x, $height - $this->_offset_y); imagecopy($temp->image, $this->_owner->image, $this->_offset_x, 0, 0, $height - $this->_offset_y, $width - $this->_offset_x, $this->_offset_y); $this->_owner->image = $temp->image; unset($temp); return true; }
public function generate() { $width = $this->_owner->getImageWidth(); $height = $this->_owner->getImageHeight(); $padding = $this->_padding; $arrColor = Color::hexColorToArrayColor($this->_color); $temp = new Canvas(); $temp->createImageTrueColor($width + $padding * 2, $height + $padding * 2); $tempcolor = imagecolorallocate($temp->image, $arrColor['red'], $arrColor['green'], $arrColor['blue']); imagefill($temp->image, 0, 0, $tempcolor); imagecopy($temp->image, $this->_owner->image, $padding, $padding, 0, 0, $width, $height); $this->_owner->image = $temp->image; unset($temp); return true; }
public function generate() { $width = $this->_owner->getImageWidth(); $height = $this->_owner->getImageHeight(); $temp = new Canvas(); if (!empty($this->_color)) { $temp->createImageTrueColor($width + ($this->_right + $this->_left), $height + ($this->_top + $this->_bottom)); $arrColor = Color::hexColorToArrayColor($this->_color); $tempcolor = imagecolorallocate($temp->image, $arrColor['red'], $arrColor['green'], $arrColor['blue']); imagefilledrectangle($temp->image, 0, 0, $temp->getImageWidth(), $temp->getImageHeight(), $tempcolor); } else { $temp->createImageTrueColorTransparent($width + ($this->_right + $this->_left), $height + ($this->_top + $this->_bottom)); } imagecopy($temp->image, $this->_owner->image, $this->_left, $this->_top, 0, 0, $width, $height); $this->_owner->image = $temp->image; unset($temp); return true; }