I'm using imagettftext to write text on top of an image - and it all works well for normally formatted text. Unfortunately I can't seem to find out if it is possible to italicise or bold text in this method. Anyone know if it's possible? If so, what needs to be done? I'm aware that there are other tools available that will do this. ImageMagick is one of them, but for some reason the -draw text command doesn't have any effect when I've tried it (and I've tried it on three different hosts). If there is no way of doing it with PHP's GD library, I would also be interested in hearing any suggestions for alternative methods.
You can do it with PHP's GD library, you just need to use your own fonts (that support bold/italic, etc.)
Thanks Shawn - you mean create font files that are already bolded or italicised right? I've no previous experience with doing this - are they any apps you would recommend?
Normally fonts are already built with italics or bold, etc. Like the Arial font for example is really made up of different versions (it's not applications that turn it into bold/italic when you want).
I have a little tool I wrote in PHP that basically does the same thing that you are trying to accomplish, except it uses the specified font to output text. You provide the script with a .ttf (True Type Font) file, state your text/font size, color, etc etc and it outputs a png image. Some fonts have bold, italics built in, etc but you could just find an alternative .ttf font file to use....Not necessarily bold the text, just a different font. It has samples, and a code generator and another script I found to add reflection to the bottom of the image for really nice headers and things of the like.... It's a small file, check it out! PHP GD Text<->PNG creator: http://iluvjohn.com/welcome-to-iluvjohn/custom-fonts-on-a-website-with-php-704/