imagettftext: Could not find open font

Published in Web Development on Thursday, October 21st, 2004

Dealing with a common problem when using php, gd and imagettftext.

In a 'zig when they zag' sort of way, I enabled image style post headings on this blog a while ago, back when siFR was catching on. Rather than use 'siffer', I went with the GD library, PHP and imagettftext. I may write a bit more about implementation at a later date, but for now this is one of those "maybe this helps someone" posts...

Frustration

Well monkeying around with PHP's imagettftext, I found myself running into a imagettftext(): Could not find/open font error anytime that I tried to use a simple text-image generating script on some of the live servers that our clients use.

I wasn't alone

I read up some other peoples problems and solutions, but nothing seemed to work it out.

Then it hit me.

A simple answer...

The font I was using had a hyphen in it's name. I changed it to an underscore and voila, magic.

Comments and Feedback

Totally cool. Post an example?

Maybe in the future, if I stick with it...

Totally. I have used this before. Good job!

Check out the blog categories for older content