你的解决了吗,我也出现这个问题
/* 打开图片 */
//1.配置图片路径
$src="..\watermark\images/holowen.jpg";
//2.获取图片信息( 通过GD库提供的方法,得到你想要处理的图片的基本信息)
$info = getimagesize($src);
//print_r ($info);
//3.通过图像的编号来获取图像的类型
$type=image_type_to_extension($info[2],false);
//4在内存中创建一个和我们图像类型一样的图片
$fun="imagecreatefrom{$type}";//$fun=imagecreatefromjpeg/png/gif;
//5.把图片复制到我们的内存
$image=$fun($src);//$image=imagecreatefromjpeg/png/gif($src);
/* 操作图片*/
$font="simhei.ttf";
$content="hello! 你好";
$color=imagecolorallocatealpha($image,255,255,255,50);
imagettftext($image,30,mt_rand(-20,34),20,40,$color,$font,$content);
/* 输出图片*/
//浏览器输出
header("Content-type:".$info['mime']);
$func= "image($type)";//imagejpeg imagepng
$func($image);
//保存图片
$func($image,'newimage.'.$type);
/* 销毁图片*/
?>