sanırım GD1 kitaplıkları gerekiyor bu fonksiyon için çünkü GD2 kitaplıkları yüklü sunucuda da çalışmıyor.
Benim kullandığım kodlar, GD2'de çalışıyor:
<?
header("Content-Type: image/jpeg");
create_image();
die();
function create_image()
{
// *** Generate a passcode using md5
// (it will be all lowercase hex letters and numbers ***
$hash1 = "cizilecekkod";
// *** Create the image resource ***
$image = ImageCreatetruecolor(80, 20);
// *** We are making two colors, white and black ***
$clr_white = ImageColorAllocate($image, 255, 255, 255);
$clr_black = ImageColorAllocate($image, 0, 0, 0);
// *** Make the background black ***
imagefill($image, 0, 0, $clr_black);
// *** Set the image height and width ***
imagefontheight(15);
imagefontwidth(15);
// *** Add the passcode in white to the image ***
imagestring($image, 5, 5, 3, $hash, $clr_white);
// *** Throw in some lines to trick those cheeky bots! ***
imageline($image, 5, 1, 50, 20, $clr_white);
imageline($image, 60, 1, 96, 20, $clr_white);
// *** Output the newly created image in jpeg format ***
imagejpeg($image);
// *** Clear up some memory... ***
imagedestroy($image);
}
?>