我在php中的图像上有水印文本的问题 我的代码是
$im='myimage.jepeg'
header ("Content-type: image/jpeg");
$string = "text on image";
$font = 4;
$width = imagefontwidth($font) * strlen($string) ;
$height = imagefontheight($font) ;
$im = imagecreatefromjpeg($im);
$x = imagesx($im) - $width ;
$y = imagesy($im) - $height;
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
imagettftext ($im, $font, $x, $y, $string, $textColor);
imagejpeg($im);
我有更改字体大小但无法正常工作
答案 0 :(得分:0)
您在脚本中使用的扩展程序jepeg
没有。所以替换下面的脚本
$im='myimage.jepeg';
到
$im='myimage.jpeg';
另外你需要注意分号;
php脚本会停止并返回错误,如果错过了将分号放在脚本的末尾。