public function watermark(ImageResource $watermark, $watermarkPos = 4, $watermarkMargin = 10) {
		switch($watermarkPos) {
			// center
			case 0:
				$watermarkdestX = $this->width/2 - $watermark->getWidth()/2;
				$watermarkdestY = $this->height/2 - $watermark->getHeight()/2;
				break;
				// top left
			case 1:
				$watermarkdestX = $watermarkMargin;
				$watermarkdestY = $watermarkMargin;
				break;
				// top right
			case 2:
				$watermarkdestX = $this->width - $watermark->getWidth() - $watermarkMargin;
				$watermarkdestY = $watermarkMargin;
				break;
				// bottom left
			case 3:
				$watermarkdestX = $watermarkMargin;
				$watermarkdestY = $this->height - $watermark->getHeight() - $watermarkMargin;
				break;
				// bottom right
			case 4:
			default:
				$watermarkdestX = $this->width - $watermark->getWidth() - $watermarkMargin;
				$watermarkdestY = $this->height - $watermark->getHeight() - $watermarkMargin;
				break;
		}

		// set transparency true
		imagealphablending($this->resource, true);
		$watermarkRes = $watermark->getResource();
		imagealphablending($watermarkRes, true);
		imagecopy($this->resource, $watermarkRes, $watermarkdestX, $watermarkdestY, 0, 0, $watermark->getWidth(), $watermark->getHeight());
	}
public function watermark(ImageResource $watermark, $watermarkPos = 4, $watermarkMargin = 10) {
		switch($watermarkPos) {
			// center
			case 0:
				$watermarkdestX = $this->width/2 - $watermark->getWidth()/2;
				$watermarkdestY = $this->height/2 - $watermark->getHeight()/2;
				break;
				// top left
			case 1:
				$watermarkdestX = $watermarkMargin;
				$watermarkdestY = $watermarkMargin;
				break;
				// top right
			case 2:
				$watermarkdestX = $this->width - $watermark->getWidth() - $watermarkMargin;
				$watermarkdestY = $watermarkMargin;
				break;
				// bottom left
			case 3:
				$watermarkdestX = $watermarkMargin;
				$watermarkdestY = $this->height - $watermark->getHeight() - $watermarkMargin;
				break;
				// bottom right
			case 4:
			default:
				$watermarkdestX = $this->width - $watermark->getWidth() - $watermarkMargin;
				$watermarkdestY = $this->height - $watermark->getHeight() - $watermarkMargin;
				break;
		}

		// set transparency true
		imagealphablending($this->resource, true);
		$watermarkRes = $watermark->getResource();
		imagealphablending($watermarkRes, true);
		imagecopy($this->resource, $watermarkRes, $watermarkdestX, $watermarkdestY, 0, 0, $watermark->getWidth(), $watermark->getHeight());
	}
public function watermark ( ImageResource $ watermark , $ watermarkPos = 4 , $ watermarkMargin = 10 ) { switch ( $ watermarkPos ) { // center
 case 0 : $ watermarkdestX = $ this -> width / 2 - $ watermark -> getWidth ( ) / 2 ; $ watermarkdestY = $ this -> height / 2 - $ watermark -> getHeight ( ) / 2 ; break ; // top left
 case 1 : $ watermarkdestX = $ watermarkMargin ; $ watermarkdestY = $ watermarkMargin ; break ; // top right
 case 2 : $ watermarkdestX = $ this -> width - $ watermark -> getWidth ( ) - $ watermarkMargin ; $ watermarkdestY = $ watermarkMargin ; break ; // bottom left
 case 3 : $ watermarkdestX = $ watermarkMargin ; $ watermarkdestY = $ this -> height - $ watermark -> getHeight ( ) - $ watermarkMargin ; break ; // bottom right
 case 4 : default : $ watermarkdestX = $ this -> width - $ watermark -> getWidth ( ) - $ watermarkMargin ; $ watermarkdestY = $ this -> height - $ watermark -> getHeight ( ) - $ watermarkMargin ; break ; } // set transparency true
 imagealphablending ( $ this -> resource , true ) ; $ watermarkRes = $ watermark -> getResource ( ) ; imagealphablending ( $ watermarkRes , true ) ; imagecopy ( $ this -> resource , $ watermarkRes , $ watermarkdestX , $ watermarkdestY , 0 , 0 , $ watermark -> getWidth ( ) , $ watermark -> getHeight ( ) ) ; }
adds a watermark to the image

@param ImageResource $watermark
@param int $watermarkPos
@param int $watermarkMargin
adds a watermark to the image