I am using the imagettftext() function to create a custom captcha script.
I have ran and tested the code successfully on my PC, running PHP (Version 5.3.8) but when I upload to my shared hosting account running PHP (Version 5.2.17) it comes up with the following error
Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/pheelco/public_html/captcha.php on line 17
This is line 17;
imagettftext($img, 25, 0, 0, 25, $text, "fonts/alger.ttf", $num);
I definitely have the folder "fonts" uploaded with that font, its in the public_html folder.
Any ideas?
Note: I don't have access to change any PHP configurations, as I'm using a shared hosting account.
Solved. It turned out the file name was "alger.TTF" with a capitalised file extension and in my code I was referring to it with a lower-case extension. For some reason this still worked in PHP 5.3.8 but not in PHP 5.2.17 I hope this helps anybody else that comes across this issue
The
imagettftext
documentation says:Did you try this? You can use
gd_info
to check which version of GD you are working with.