[thelist] Convert Text to Image in PHP

Bob Meetin bobm at dottedi.biz
Sun Dec 14 14:37:07 CST 2008

I have not used this yet, but here's a jQuery plug-in that might help:


ImageMagick should be able to do this via convert. I played with creating text a while go just to see, but didn't have a live need.


convert -background floralwhite -fill "#568100" -size 200x label:"Fred Jones" fred_jones.png

convert -background floralwhite -fill "#568100" -size x100 label:"Fred Jones" fred_jones2.png

in PHP:

you can use system

system ("convert ...");


Fred Jones wrote:
> I have a need to convert styled text into an image format using PHP.
> Specifically, I need to take this text, which I could convert into
> either HTML or any other format (it's different fields and each is
> actually plain text but has a fixed output format we need in the
> image) and create an image of some sort (JPG,PNG etc.). So I might
> have a title and a teaser and we want the title to be 20pt red text
> and the teaser to be 30 pixels lower and in 12px black text.
> Then I need to attach this image to another image of the same height,
> so that they sit side by side and create one large, wide image.
> I am doing this because then we will feed a set of these into
> SlideShowPro [1] to create a slideshow out of the images. Yes, we
> could use jQuery Carousel instead but the effects in SlideShowPro are
> much nicer. :)
> My Flash guy says he doesn't know how exactly he could integrate
> actual text into the tool, so I said that I could probably convert it
> first into an image and then just send him those images. I have never
> done this before and I see there are a few tools available for our
> Linux server, such as ImageMagick or GD. I think GD and associated
> "built-in" PHP functions should be able to handle this, but I wanted
> to ask for any thoughts.
> Thanks,
> Fred
> [1] http://slideshowpro.net

Bob Meetin

Hook up with me on Twitter, Facebook, LinkedIn, Plaxo Pulse and Bebo
or catch my blog at www.dottedi.biz/blog.php

Standards - you gotta love em - there are so many to choose from!

More information about the thelist mailing list