Oh fiddlesticks
Something's gone wrong here. Try again and see if it works, if it doesn't you're allowed to shout at me.

Tag Archives: font

Generating previews with imagettftext

Posted: November 15th, 2013
Tagged: ,

Long time no blog!

I’ve been so busy at work recently I haven’t had any time to work on other stuff, and for the record, I’ve now got plans to rewrite my sort-of-game engine under Haxe 3 and OpenFL, so whenever I get around to that expect some new articles!

But today I have a little php nugget I had to put together recently that I think someone will find useful!

In the past I’ve dabbled with generating images dynamically in php – usually basic stuff, website statistics etc. But recently I had to do something a little more advanced in generating preview images of letters that people would be paying for. This involved placing a large amount of text within a series of template images – including ones with oddly shaped spaces where the text would have to go, which presents the problem of getting it to fit in the gap. I guess you could brute force it – manually position each line – but that’s frankly ludicrous and not future-friendly at all.

So, let’s make a solution. (more…)