Tag: font

Generating previews with imagettftext

Long time no blog! I’ve been so busy at work recently I haven’t had any time to work on other stuff.

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.

Continue reading “Generating previews with imagettftext”