我試試這個代碼imagettftext()
:imagettftext不工作
// Set the content-type
header('Content-Type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
但它不工作,因爲它應該,我有GD和FreeType的安裝,你可以看到:
誰都可以指着我正確的方向?
你好,顯示的錯誤是什麼? (要查看它,請在刪除內容類型標題後直接訪問您的圖像)。 – 2014-11-04 18:35:39