我使用下面的代碼顯示圖像,顯示有多少用戶連接到我的網站的文本。我用另一個替換了我使用'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