Hi Folks,
I’ve run into a strange problem displaying the CAPTCHA verification codes in forms. I have several forms throughout the site and the CAPTCHAs were displaying fine until a couple of days ago. The site is running on a subdomain, on php4. When I run phpinfo.php it says GD is supported but there is no mention of Freetype - I know both of these things are required to generate CAPTCHAs but then how come they were dispaying ok until recently?
Instead of the CAPTCHA image I get a blank with ’verification code’ and if I look at the source I get <img src="/manager/includes/veriword.php?rand=2145727560" alt="verification code" /> . If I put this source in a browser I get ’
Fatal error: Call to undefined function: imagettfbbox() in /home/softplan/public_html/learn/manager/includes/veriword.php on line 124’
Anyone got any ideas?
thanks
Danny
Thanks, just check and GD vesion 2.0.28 is installed so I guess that’s ok. I wonder if it might be a subdomain issue.
I found this via Google:
"Using imagettfbbox with relative font paths in PHP >= 4.3.0 may result in an error. A solution seems to be to use absolute paths. If this isn’t the issue, it could be spaces in the filename."
Try hardcoding the path in line 124 of veriword.php.
Thanks....can’t see any path in line 124 of veriword.php just ’ $box = imagettfbbox ( $text_size, $text_angle, $text_font, $this->word);’
I notice there’s paths to the font (ttf) and noises directories at the top of veriword.php but if I put absolute paths in here it gives me even more errors.
I don’t have the original version of vericode.php but the section that’s causing the trouble should look something like this:
$dir = dir("[color=red]./ttf[/color]");
$fontstmp = array();
while (false !== ($file = $dir->read())) {
if($file!="." && $file!=".." && file_exists('[color=red]./ttf/[/color]'.$file) && !is_dir('[color=red]./ttf/[/color]'.$file)) {
$fontstmp[] = '[color=red]./ttf/[/color]'.$file;
}
}
All the highlighted sections would have to be changed to a full absolute paths--probably from your user root (not the site root). e.g. /home/user/public_html/site_name/. etc.
Thanks Bob, will give that a try