任何人都可以告訴我爲什麼我不能使用函數imagettftext當我試圖創建一個驗證碼?它適用於圖像字符,但字體大小很小,所以我必須使用imagettftext ...這是一個Wamp的問題或它是什麼?謝謝你的時間!爲什麼在這種情況下PHP imagettftext函數不起作用?
PHP代碼(到目前爲止):
<?php
session_start();
header("Content-Type: image/png");
$text = $_SESSION['secure'];
$font_size = 30;
$image_width = 200;
$image_height = 40;
$image = imagecreate($image_width, $image_height);
imagecolorallocate($image, 255, 255, 255);
$text_color = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, $font_size, 0, 15, 30, $text_color, 'arial.ttf', $text);
imagepng($image);
?>
的index.php:
<?php
session_start();
$_SESSION['secure'] = rand(1000,9999);
?>
<img src="createanimage.php" />
你是什麼意思你「不能使用它」?你能發佈錯誤日誌嗎? – JM4 2011-12-13 22:08:32