2014-07-11 29 views
0

我使用圖像功能進行測試,但它最終在瀏覽器上出現問號。 你知道如何解決這個問題嗎? 我使用safari作爲我的瀏覽器。PHP成像顯示問號

<?php 

$image = imagecreate(350,70); 

$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); 
$black = imagecolorallocate($image, 0x00, 0x00, 0x00); 

putenv("DGFONTPATH=".realpath('.')); 

imagettftext($image, 20, 0, 10, 40, $black, 'arial.ttf', "Courier TrueType"); 

header("Content-Type:image/png"); 
imagepng($image); 




?> 

回答

2

您有一個錯字。替換:

putenv("DGFONTPATH=".realpath('.')); 

有:

putenv("GDFONTPATH=".realpath('.')); 
     ^^ 
+0

謝謝,但我還是有問號的瀏覽器.. – Tosh

+0

@Toshi試試這個:http://stackoverflow.com/questions/8866743/imagettftext -cannot-找到的字體,位置 – Phantom