PHP ImageTTFText

时间:2013-12-03 20:55:00

标签: php gdlib

为什么这只显示背景图片,而不是文字? 没有backgroundimage就可以了......

$code = rand(1000, 99999);
$_SESSION["code"] = $code;
$font = '../fonts/captcha.ttf';
$y = 30;
$x = 10;
$width = 100; //Image width in pixels
$height = 40; //Calculating image height 
$image = ImageCreate($width, $height);
$img = imagecreatefromgif('img/captcha.gif');
$bgtext = imagecolorallocate($img, 145,145,145);
ImageTTFText($image, 16, 0, $y, $y, $bgtext, $font, $code);
header('Content-type: image/png');
imagegif($img);
imagedestroy($img);

0 个答案:

没有答案