【发布时间】:2013-03-30 06:27:14
【问题描述】:
我的服务器上有一张图片,我想给它写文字。像水印一样。我可以在图像中写入文本,但我想为文本添加背景以便于阅读。这是我目前所拥有的。
header("Content-type: image/jpeg");
$imgPath = 'pic.jpg';
$image = imagecreatefromjpeg($imgPath);
$color = imagecolorallocate($image, 224, 73, 87);
$string = "Please type the word in the circle.";
$fontSize = 8;
$x = 25;
$y = 200;
imagestring($image, $fontSize, $x, $y, $string, $color);
imagejpeg($image);
【问题讨论】:
-
您可以在这里查看:stackoverflow.com/questions/2235152/… 可能会回答您的问题。