0

我正在尝试将文本添加到预定义的图像,但没有这样做。我正在使用的代码如下:

<?php   
header("Content-type: image/png");
if(file_exists("stats_gen.png")){ unlink("stats_gen.png");} //delete old version
$string = "text";
$im     = imagecreatefrompng("stats.png");
$textcolor = imagecolorallocate($im, 0, 0, 255);
imagestring($im, 5, 0, 0, $string, $textcolor);
imagepng($im); //show the image for debug purposes
imagepng($im, "stats_gen.png"); //save the image
imagedestroy($im);
?>

stats.png 看起来像这样:哦,不支持图像格式。好吧,这个: http: //lolmewn.nl/stats/stats.png并最终像http://lolmewn.nl/stats/stats_gen.png看起来很垃圾。我究竟做错了什么?谷歌似乎没有给出任何答案......

4

1 回答 1

0

使图像背景不透明。呵呵。

于 2012-12-09T15:03:04.760 回答