一个超级强大的图片加水印的类(7)
$this -> waterImg_info[1]);
$pct = $this -> transparent;
imagecopy($cut, $this -> water_im, 0, 0, 0, 0, $this -> waterImg_info[0],
$this -> waterImg_info[1]);
//将图片与水印图片合成
imagecopymerge($this -> im, $cut, $this -> x, $this -> y, 0, 0, $this -> waterImg_info[0], $this -> waterImg_info[1], $pct);
}
/**
* 加文字水印
*/
private function waterstr ()
{
$rect = imagettfbbox($this -> fontSize, 0, $this -> fontFile, $this -> waterStr);
$w = abs($rect[2] - $rect[6]);
$h = abs($rect[3] - $rect[7]);
$fontHeight = $this -> fontSize;
$this -> water_im = imagecreatetruecolor($w, $h);
imagealphablending($this -> water_im, false);
imagesavealpha($this -> water_im, true);
$white_alpha = imagecolorallocatealpha($this -> water_im, 255, 255, 255, 127);
imagefill($this -> water_im, 0, 0, $white_alpha);
$color = imagecolorallocate($this -> water_im, $this -> fontColor[0], $this -> fontColor[1],
$this -> fontColor[2]);
imagettftext($this -> water_im, $this -> fontSize, 0, 0, $this -> fontSize, $color,
$this -> fontFile, $this -> waterStr);
$this -> waterImg_info = array (
0 => $w, 1 => $h
);
$this->waterimg();
}
/**
* 水印图片输出
*/
public function output ()
{
$this->imginfo();
相关新闻>>
- 发表评论
-
- 最新评论 更多>>