Volker: Problem mit Imagettftext

Beitrag lesen

Hallo zusammen,
ich stehe (seit geraumer Zeit) vor folgendem Problem:
Um mein Gästebuch vor Spam zu schützen, will ich ein Captcha kreieren.

In meinem Bild, der captcha.php, steht folgendes:
function createCaptcha($width, $height) {
 mt_srand((double)microtime()*1000000);
 $captcha = mt_rand(1000, 99999);
 $captcha = md5($captcha);
 $captcha = substr($captcha, 0, 5);
 $captcha = strtoupper($captcha);
 $_SESSION['captcha'] = $captcha;
 $image = imagecreate($width, $height) or die("Can't initialize GD image stream");
 $bg_color      = imagecolorallocate($image, 255, 255, 255);
 $line_color    = imagecolorallocate($image, 150, 150, 150);
 $elpise_color  = imagecolorallocate($image, 200, 200, 200);
 $elpise_color2 = imagecolorallocate($image, 235, 235, 235);
 $text_color    = imagecolorallocate($image, 0, 0, 0);
 $rand_h1 = mt_rand(1, 40);
 $rand_h2 = mt_rand(1, 40);
 $rand_h3 = mt_rand(1, 40);
 $rand_h4 = mt_rand(1, 40);
 $rand_h5 = mt_rand(1, 40);
 $rand_v1 = mt_rand(1, 100);
 $rand_v2 = mt_rand(1, 100);
 $rand_v3 = mt_rand(1, 100);
 $rand_v4 = mt_rand(1, 100);
 $rand_v5 = mt_rand(1, 100);
 imageline($image, 0, $rand_h1, 100, $rand_h1, $line_color);
 imageline($image, 0, $rand_h2, 100, $rand_h2, $line_color);
 imageline($image, 0, $rand_h3, 100, $rand_h3, $line_color);
 imageline($image, 0, $rand_h4, 100, $rand_h4, $line_color);
 imageline($image, 0, $rand_h5, 100, $rand_h5, $line_color);
 imageline($image, $rand_v1, 0, $rand_v1, 50, $line_color);
 imageline($image, $rand_v2, 0, $rand_v2, 50, $line_color);
 imageline($image, $rand_v3, 0, $rand_v3, 50, $line_color);
 imageline($image, $rand_v4, 0, $rand_v4, 50, $line_color);
 imageline($image, $rand_v5, 0, $rand_v5, 50, $line_color);
 imagefilledellipse($image, mt_rand(0, 100), mt_rand(0, 40), mt_rand(10, 40), mt_rand(10, 25), $elpise_color);
 imagefilledellipse($image, mt_rand(0, 100), mt_rand(0, 40), mt_rand(20, 40), mt_rand(10, 25), $elpise_color);
 imagefilledellipse($image, mt_rand(0, 100), mt_rand(0, 50), mt_rand(20, 50), mt_rand(10, 35), $elpise_color2);
 if (function_exists("Imagettftext")) {
****  Imagettftext ($image, 22, 0, 10, 30, $text_color, "http://blabla.de/font.ttf", $captcha);
 } else {
  imagestring($image, 5, 25, 12, $captcha, $text_color);
 }
 header("Content-type: image/png");
 imagepng($image);
 imagedestroy($image);
}
    session_start();
    createCaptcha(100, 40);

Allerdings bekomme ich die Fehlermeldung
"Warning: imagettftext() [function.imagettftext]: Could not find/open font in captcha.php on line ****
Allerdings ist der Pfad sehr wohl korrekt, da bei direkter Eingabe die Datei font.ttf in den Browser downloadbar ist.
Was habe ich übersehen? Zur Information: Das sind geringfügig modifizierte Code-Ausschnitte aus "myPHP guestbook", d.h. der Code müsste an sich doch korrekt sein!?
Danke im Voraus für Hilfe.
Gruß, Volker