我使用下面的代码显示图像,显示有多少用户连接到我的网站的文本。我用另一个替换了我使用'vad.png'的图像。现在我收到错误“图像无法显示,因为它包含错误”生成图像 - 无法显示图像,因为它包含错误
任何人都知道我可以解决这个问题吗?
$result = mysql_query("SELECT * FROM server_status");
$row = mysql_fetch_array($result);
$text = "Online";
$image = imagecreatefrompng('vad.png');
$black = imagecolorallocate($image, 10, 0, 0);
if (strlen($row['users_online']) >= 3){
imagefttext($image, 11, 0, 435, 38, $black, './verdana.ttf', $row['users_online']);
}
else
{
imagefttext($image, 11, 0, 440, 38, $black, './verdana.ttf', $row['users_online']);
}
imagefttext($image, 8, 0, 432, 55, $black, './verdana.ttf', $text); // Remove the // ahead of this line to use it
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
你冷这样做与文本和CSS,为什么首先使用图像。 – 2012-02-08 03:51:32