PHP ImageTTFText

75 views Asked by At

why this show only the background image, and not the text? Without backgroundimage it's work...

$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

There are 0 answers