Exemplo n.º 1
0
	/**
	 * Returns image width.
	 * @return int
	 */
	public function getWidth()
	{
		return $this->file === NULL ? parent::getWidth() : $this->width;
	}
Exemplo n.º 2
0
 /**
  * Puts another image into this image.
  * @param  Image
  * @param  mixed  x-coordinate in pixels or percent
  * @param  mixed  y-coordinate in pixels or percent
  * @param  int  opacity 0..100
  * @return Image  provides a fluent interface
  */
 public function place(Image $image, $left = 0, $top = 0, $opacity = 100)
 {
     $opacity = max(0, min(100, (int) $opacity));
     if (substr($left, -1) === '%') {
         $left = round(($this->getWidth() - $image->getWidth()) / 100 * $left);
     }
     if (substr($top, -1) === '%') {
         $top = round(($this->getHeight() - $image->getHeight()) / 100 * $top);
     }
     if ($opacity === 100) {
         imagecopy($this->getImageResource(), $image->getImageResource(), $left, $top, 0, 0, $image->getWidth(), $image->getHeight());
     } elseif ($opacity != 0) {
         imagecopymerge($this->getImageResource(), $image->getImageResource(), $left, $top, 0, 0, $image->getWidth(), $image->getHeight(), $opacity);
     }
     return $this;
 }
Exemplo n.º 3
0
sharpen(){imageconvolution($this->getImageResource(),array(array(-1,-1,-1),array(-1,24,-1),array(-1,-1,-1)),16,0);return$this;}function
place(Image$image,$left=0,$top=0,$opacity=100){$opacity=max(0,min(100,(int)$opacity));if(substr($left,-1)==='%'){$left=round(($this->getWidth()-$image->getWidth())/100*$left);}if(substr($top,-1)==='%'){$top=round(($this->getHeight()-$image->getHeight())/100*$top);}if($opacity===100){imagecopy($this->getImageResource(),$image->getImageResource(),$left,$top,0,0,$image->getWidth(),$image->getHeight());}elseif($opacity<>0){imagecopymerge($this->getImageResource(),$image->getImageResource(),$left,$top,0,0,$image->getWidth(),$image->getHeight(),$opacity);}return$this;}function