夥計們,我用它們的X,Y座標和給它們賦值了大約288點。我需要象徵性地表明這一點。我嘗試了gd和imagettftext,但是即使我安裝並配置了gd,繪製空白圖像的簡單代碼也無法正常工作。在PHP中繪製圖像並且不顯示任何圖像
header('Content-Type: image/png');
$image = imagecreatetruecolor(400, 300);
// Allocate a color for the polygon
$col_poly = imagecolorallocate($image, 255, 255, 255);
// Draw the polygon
imagepolygon($image, array(
0, 0,
100, 200,
300, 200
),
3,
$col_poly);
// Output the picture to the browser
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
在瀏覽器的輸出是
你試過了什麼? – 2012-08-08 21:54:05
我試過這段代碼,並希望用值的文本填充圖像。但是一個簡單的函數不工作。可能是我的GD庫配置不正確。 – user1425322 2012-08-08 22:00:58
順便說一句,爲什麼你設置標題兩次,並以不同的情況? 還要確保你的php文件中沒有空格(如果你有include,請檢查它們)。 這是一個好主意,可以讓圖像在二進制編輯器中查看。 – 2012-08-08 22:02:12