php text on img
- Started
- Last post
- 13 Responses
- xrusos
how can i dynamcally add text to an image using php?
--
remember those old pranks that did this? they featured an image of a person holding a sign that had your name on it?
now i need that ability for a good purpose, but can't find how to do it.
- xrusos0
any bidders today?
- unknown0
yes.
- ********0
just do an image with a layer on top. or make a pdf from php with the users info blabla
- unknown0
what are you trying to do?
You can use the gd libraries, to write text on the images you created.
- xrusos0
gd libraries?
i'm developing an online application where people can choose between a few photos online and then add text dynamically to that image (without using photoshop - all done through the web browser).
so i would define the font. and i would identify the image. and a user would input the text into a text field. and then php would take the text and add it to the image chosen in the coordinate spot identified in the code using the font i previously determined to create a brand spankin' new image.
- enobrev0
gd should do it. I've been using ImageMagick for it for about a year now, which works really well, but is a bit confusing to figure out at first.
Check your host to see if you have either one and go from there.
- xrusos0
what is gd?
- unknown0
what is ImageMagick? never heard about that before. Is it just like gd?
any websites to look it up, or tutorials on it?
- enobrev0
gd is a 'library' or set of functions that can be added to php for image manipulation. There's quite a few tutorials on it out there. My primary issue with it has always been speed. It runs a bit slow depending on how extensively you're using it.
ImageMagick is a command-line app that can be installed on linux (i believe there's a gui version and other platform support as well). You can use php's system functions to use ImageMagick. It's confusing, but incredibly robust and fast
I think there's also a php extension for ImageMagick, although I've never looked into it much.
hit google and you should find some tutorials and sample code on both.
- xrusos0
actually, i'm looking for something more like this:
- SaintWalker0
ImageMagik licks my bag...but that's a good thing because I like it.
Seriously it is really really robust like enobrev said. It even gives you the ability to do tons of image tranforming and gay filters just like PhotoShop has...twirls, swirels and zigzags...it's nuts.
I installed it on OS X and after a bit of hastle figured out how it works, its' not so well documented but this site might help ya out: http://www.entropy.ch/
I think Marc has an installer package made for ImageMagik. Good luck!