hey there,
I picked this up at some point and found it useful.....maybe you will too...
<?php
/*
displays base64_decode($_GET['text']); - useful for email addresses
example usage:
//to specify the color of text
<img src="email.php?r=255&g=0&b=0&text=cHVyZW1hbmdvLmNvLnVrQGdtYWlsLmNvbQ==">
//default to black colored text
<img src="email.php?text=cHVyZW1hbmdvLmNvLnVrQGdtYWlsLmNvbQ==">
*/
header("Content-Type: image/png");
// get amounts and titles from session.
$text = base64_decode($_GET['email']);
// calculate required width and height of image
$pic_width = strlen($text)*7;
$pic_height = 14;
// create image
$pic = imagecreate($pic_width+1,$pic_height+1);
// allocate colours
$white = imagecolorallocate($pic,255,255,255);
$grey = imagecolorallocate($pic,200,200,200);
$lt_grey = imagecolorallocate($pic,210,210,210);
$black = imagecolorallocate($pic,0,0,0);
$trans_temp = imagecolorallocate($pic,254,254,254);
$transparent = imagecolortransparent($pic,$trans_temp);
// using isset not !empty, as values could=0, therefore "empty"
if(isset($_GET['r']) && isset($_GET['g']) && isset($_GET['b']))
{
$user = imagecolorallocate($pic,intval($_GET['r']),intval($_GET['g']),intval($_GET['b']));
} else {
$user = $black;
}
// transparent fill for background
imagefilledrectangle($pic,0,0,$pic_width,$pic_height,$trans_temp);
$font = "tahoma.ttf";
// draw text
imagettftext($pic,9,0,0,12,$user,$font,$text);
// output image
imagepng($pic);
// remove image from memory
imagedestroy($pic);
?>
<edit>BTW, you need GD library for this, and the ttf file you want to use for the font if its not installed on your system</edit>