PHP GD: Could not find/open font

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

PHP GD: Could not find/open font

Post by RandomEngy »

I made a random quote image with PHP and GD and it works most of the time, but about 1 in 10 tries it gives the following errors:

Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettfbbox(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 339
Warning: imagettftext(): Could not find/open font in /hsphere/local/home/randomen/engy.us/randsig.php on line 244
Warning: Cannot modify header information ...

And so on.

You can see it in action if you keep refreshing:

http://engy.us/randsig.php?bgcolor=tran ... &height=80

This is one of the function calls I make. Nothing special, string has stuff in it, size is 10, and font is "./arial.ttf" located in the same folder as the script.

Code: Select all

imagettfbbox($fontsize, 0, $font, $string)
phpinfo: http://engy.us/phpinfo.php

When I searched the problem the only thing I came across was people having trouble with spaces or hyphens in the font names, nothing erratic like this. What's the deal here? Problem with, PHP, GD, or my hosting?
Post Reply