нашёл в книге скрипт капчи. помогите разобраться с ошибкой. Warning: imagettftext() [function.imagettftext]: Invalid font filename in Z:\home\localhost\www\1.php on line 31 PHP: $w=300; $h=50; $gfx=imagecreatetruecolor($w, $h); imageantialias($gfx, true); $white = imagecolorallocate($gfx,255, 255, 255); imagefilledrectangle($gfx, 0, 0, $w-1, $h-1, $white); $str=''; foreach(range(0, rand(5,7)) as $r) { $str.=chr(rand(65,90)); } $pos=$w/strlen($str); foreach(range(0,strlen($str)-1) as $s) { $shade=rand(0,100); $tmpgray = imagecolorallocate($gfx,$shade,$shade,$shade); imagettftext($gfx, rand($h/3,$h/2), rand(-60,60), $s*$pos+($pos*.4), rand($h*.5,$h*.7), $tmpgray, 'arial', $str{$s}); } foreach(range(-$h,$w,5) as $x) { $shade=rand(50,254); $tmpgray = imagecolorallocate($gfx,$shade, $shade, $shade); imageline($gfx, $x, 0, $x+$h+rand(0,25),$h-1, $tmpgray); imageline($gfx, $x, $h-1, $x+$h+rand(0,25), 0, $tmpgray); } //session_start(); //$_SESSION['captcha']=$str; //header('Content-type:image/png'); //imagepng($gfx);
строчка Invalid font filename кагбэ намекает нам, что 'arial' - неправильное имя файла с фонтом с точки зрения php. Патамушта правильное имя файла это "/path/arial.ttf". Если конечно ты не положил фонт в файл без расширения в document root