 
		木上草
2017-02-21 20:53
/*图片压缩*/
public function thumbImage($width,$height){
    $image_thumb=imagecreatetruecolor($width,$height);
    imagecopyresampled($image_thumb,$this->image,0,0,0,0,$width,$height,$this->imageinfo['width'],$this->imageinfo['height']);
    imagedestroy($this->image);
    $this->image=$image_thumb;
}
/*添加文字水印*/
public function fontMark($content,$font_url,$font_size,$color,$local,$angle){
    $colortrue=imagecolorallocatealpha($this->image,$color[0],$color[1].$color[2],$color[3]);
    imagettftext($this->image,$font_size,$angle,$local['x'],$local['y'],$colortrue,$font_url,$content);
}
/*浏览器中显示图片*/
public function showImage(){
    header("Content-type:",$this->imageinfo['mime']);
    self::printImage($this->image);
}
/*保存实体文件*/
public function saveImage($picName){
    $picturename=$picName.'.'.$this->imageinfo['type'];
    self::printImage($this->image,$picturename);
}
 
				$content='hello world'后面应该是分号;
 
				那块是截得屏幕里的图片,讲到那块自己错了,后面视屏里改回来了,我出现的主要错误是
$colortrue=imagecolorallocatealpha($this->image,$color[0],$color[1].$color[2],$color[3]);
这一行的$color[1].$color[2]之间用点连接了,导致参数少了一个报错,不过还是谢谢你了
 
				逗号都不对,都是分号才行。
GD库实现图片水印与缩略图
19005 学习 · 168 问题
相似问题