Saving dynamic text as background art...

OK, here’s what I’m trying to do… I have a PHP-based shopping cart running on a Linux server. People can order a personalized CD from that cart with printing on the front of their choosing.

Today, the process is that the text gets copied and pasted into Windows-based software that prints the CD, and the font size gets adjusted so that it looks right. In other words a short message will have a larger font size to fill the space, and a long message gets a smaller font size. I have a stock background image that the text gets printed on.

What I want to do instead is somehow take the text, and run it through some process that sizes it appropriately (increasing or decreasing the font as necessary, and saves it along with the background layer as a PNG, TIFF, JPEG, or PDF.

That PNG, TIFF, JPEG, or PDF would then get referenced by a company that would produce the CD (I’d send them an XML file that contained the path to the file on my server).

My first thought was that maybe I could have some Word document that contained the CD art background and merge codes, and some automated process (VBA Script?) would size the text, and save the document as a PDF.

However, Ideally everything would happen on the Linux server, since that is where my shopping cart is. Does anyone know of any tools I can leverage that would help me accomplish what I’m trying to do?

Thanks in advance.

Do you have any scripting/programming background? This is the type of thing that ought to be doable using PHP/Perl/any web scripting language in conjunction with ImageMagick and the appropriate extension for your language (such as imagick for PHP).

You might also want to search resourceindex.com and Hotscripts.com for “watermark”; that’s essentially what you’re doing, and the only hard part would be finding something that can auto-size it according to text length.

The PHP GD library will help you.
You will need to write some PHP code to take the text, then using predetermined sized (say 400x400 which is your image size) size the text based on the string of characters and the area to be filled.
You can then place that text on your background image and save it to your server for printing.

I looked up Image Magick, and it indeed will fit text to a certain size. It looks like it will fit the bill perfectly. I also was unaware of the PHP GD library, which has a robust set of tools (except the resizing).

Thanks for the info!!