PDA

Click to See Complete Forum and Search --> : Text > Image (With Fonts)


Pino
Apr 25th, 2008, 05:56 AM
Hey,

I need to generate a PNG file from text and there are plenty of examples out there for this, however I need to use a specific font, the font needs to be user selected so they upload the font. From what I can see this will be .ttf or open type.

Any suggestions?

dclamp
Apr 27th, 2008, 12:26 PM
well you are going to want to use the GDLib.

what you need is a textarea for the user to put their text (or an upload if you wish), and a upload field for the users font. Something you can also do (instead of having the users upload multiple .ttf fonts, is have a dropdown with all the available fonts that the user can choose from)

then, once you have uploaded the font somewhere, you will use the gdlib to make the image and use imagettftext (http://us.php.net/manual/en/function.imagettftext.php) to set the font.

I am not sure if you are familiar with the gdlib... so let me know.