Hello i have some code which is suppose to create a simple captcha image...the code was working fine until it was moved from one location to another...now what it does is the image is created...but for some reason, it's not displaying the text.
Here is my code :
<?php
session_start();
$image = imagecreate(100, 50);
$background = imagecolorallocatealpha($image, 204, 204, 204, 127);
$text = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 20, 0, 30, 30, $text, 'Gabriola.ttf', $_SESSION['captcha']);
$lines = 20;
for($i = 0; $i <= $lines; $i++){
$x1 = rand(1, 100);
$y1 = rand(1, 100);
$x2 = rand(1, 100);
$y2 = rand(1, 100);
imageline($image, $x1, $y1, $x2, $y2, $text);
}
header('content-type: image/jpeg');
imagejpeg($image);
?>
this code does create the gray box and displays the 20 lines but no text. when i echo out the $_SESSION['captcha'] on the page it displays the number generated (generated in another file)....i've even replaced that with a string and it doesn't work...the interesting thing about it is that it works on local machine but not on a hosted page...what could possibly cause this?...all the files were changed so the .ttf file is also within the same file as this page