Somebody asked the other day how they could take the hassle out of changing their signature tag automatically for a forum so that they could show off more of thier artwork to passing readers.
Using the GD library functions for PHP allows you create images from scratch or add text to existing ones. The example above is drawn using this process with the content being provided by an RSS feed but could just as easy be the viewers IP address or your twitter feed for instance.
You could use other variables to choose what image is displayed such as local time, referer, IP address, browser type, screen size etc. Here's a quick code snippet. Or you can see the live code in action here
http://bishop.comxa.com/e6_epsilon/index.php
PHP Code:
$newtext ="text to go on image";
header("Content-type: image/png");/// setup output image type jpg,gif,png
$im = imagecreatefrompng("base.png"); //get background image
// setup text colour using RGB values
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);
// Path to ttf font file
$font_file = 'tahoma.ttf';
// make text jump to newline if longer 40 characters
$newtext = wordwrap($headline, 40, "\n");
// Draw the text
$fontSize = 14 ; // size of text
$rotation = 0 ; // rotate text
$Xpos = 25 ; // x position start text
$Ypos = 25 ; // y position ,, ,,
imagefttext($im, $fontSize, $rotation, $Xpos, $Ypos, $black, $font_file, $newtext);
// Output image
imagepng($im); /// display
//or Save the image as
//imagepng($im, 'sig.png'); /// saving image makes page display fail
imagedestroy($im);//// tidying up variables for next visitor