I wrote this script a while back as a proof of concept. I haven't done anything with it, but I thought I'd share it in case anybody else was interested. It will need some customization before it will do anything useful for your site. You need imagemagick installed for this to work, and it assumes the location of 'convert' is in /usr/bin and it also assumes that you want to put the sample image at /usr/local/apache/hosts/mysite/images/mg/test.gif. To test this out, you'll want to edit/verify the locations of files on line 13 (begins with '$commandstring')and on line 84 and 85 (last two lines before </body>. Also, it assumes it's own name is /img.php - which you can edit on line 23 ('form action="/img.php"') Basically, what this does is takes some parameters from a form and runs the imagemagick program 'convert' from the command line to create an image. I think this is pretty open to a buffer overflow, since it passes parameters to the command line. Shawn or somebody here might know an easy way to limit the length of the command string. I suppose I could just truncate it. Anyhow, here is the script: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Text Image Builder</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php $text = $_POST['imagetext']; $dimensions = $_POST['dimensions']; $background = $_POST['background']; $font = $_POST['font']; $points = $_POST['points']; $executed = "NO"; $commandstring = "echo \"".$text."\" | /usr/bin/convert -background ".$background." -page ".$dimensions." -font ".$font." -pointsize ".$points." text:- /usr/local/apache/hosts/mysite/images/mg/test.gif"; if (!($text == NULL)){ $executed = "YES"; $output = shell_exec($commandstring); } ?> </head> <body> <? echo $_POST['imagetext']; ?> <form action="/img.php" method="post" enctype="application/x-www-form-urlencoded" name="Image Create" target="_self"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td>Image Text</td> <td><input name="imagetext" type="text" value=<? echo "\"".$text."\""; ?> size="80" maxlength="30"></td> </tr> <tr> <td>Dimensions</td> <td><input type="text" name="dimensions" value=<? echo "\"".$dimensions."\""; ?> size="20" maxlength="10"></td> </tr> <tr> <td>Background</td> <td><input type="text" name="background" value=<? echo "\"".$background."\""; ?> size="30" maxlength="30"></td> </tr> <tr> <td valign="top">Font</td> <td><select name="font"> <option value="AvantGarde-Book" selected> AvantGarde-Book</option> <option value="AvantGarde-BookOblique"> AvantGarde-BookOblique</option> <option value="AvantGarde-Demi"> AvantGarde-Demi</option> <option value="AvantGarde-DemiOblique"> AvantGarde-DemiOblique</option> <option value="Bookman-Demi"> Bookman-Demi</option> <option value="Bookman-DemiItalic"> Bookman-DemiItalic</option> <option value="Bookman-Light"> Bookman-Light</option> <option value="Bookman-LightItalic"> Bookman-LightItalic</option> <option value="Courier"> Courier</option> <option value="Courier-Bold"> Courier-Bold</option> <option value="Courier-Oblique"> Courier-Oblique</option> <option value="Courier-BoldOblique"> Courier-BoldOblique</option> <option value="Helvetica"> Helvetica</option> <option value="Helvetica-Bold"> Helvetica-Bold</option> <option value="Helvetica-Oblique"> Helvetica-Oblique</option> <option value="Helvetica-BoldOblique"> Helvetica-BoldOblique</option> <option value="Helvetica-Narrow"> Helvetica-Narrow</option> <option value="Helvetica-Narrow-Oblique"> Helvetica-Narrow-Oblique</option> <option value="Helvetica-Narrow-Bold"> Helvetica-Narrow-Bold</option> <option value="Helvetica-Narrow-BoldOblique"> Helvetica-Narrow-BoldOblique</option> <option value="NewCenturySchlbk-Roman"> NewCenturySchlbk-Roman</option> <option value="NewCenturySchlbk-Italic"> NewCenturySchlbk-Italic</option> <option value="NewCenturySchlbk-Bold"> NewCenturySchlbk-Bold</option> <option value="NewCenturySchlbk-BoldItalic"> NewCenturySchlbk-BoldItalic</option> <option value="Palatino-Roman"> Palatino-Roman</option> <option value="Palatino-Italic"> Palatino-Italic</option> <option value="Palatino-Bold"> Palatino-Bold</option> <option value="Palatino-BoldItalic"> Palatino-BoldItalic</option> <option value="Times-Roman"> Times-Roman</option> <option value="Times-Bold"> Times-Bold</option> <option value="Times-Italic"> Times-Italic</option> <option value="Times-BoldItalic"> Times-BoldItalic</option> <option value="Symbol"> Symbol</option> </select>   <input name="points" type="text" value="14" size="10" maxlength="3"></td> </tr> <tr> <td valign="top"> </td> <td><input type="submit" name="Submit" value="Submit"></td> </tr> </table> </form> <p><? if($executed == "YES") {echo $commandstring."<br>".$output."<br>".$text."<br>".$executed;} ?> </p> <p><img name="example" src="/images/mg/test.gif" alt="example"> <a href=/images/mg/test.gif>direct link</a></p> </body> </html> PHP: Not very useful in and of itself, but a decent starting point if you wanted to do something like this. Oh yeah, and the dimensions field should be in the form lengthxwidth ex. 200x150
I would look into using the libraries rather than running a command. Shouldn't be too difficult to translate it - although i don't have any plans to do so within the next month.