php text text creation to generate images
Many people now want to generate text images. PHP's GD library allows us to do just that. Here we give a simple method that is to put an image on a web page using an email address. Some say this helps keep email harvesters away, but with its optical character recognition this is still possible.
// show the correct header for the image type
header("Content-type: image/jpg");
// an email address in a string
$string = "email@example.com";
// some variables to set
$font = 4;
$width = ImageFontWidth($font ) * strlen($string);
$height = ImageFontHeight($font);
// lets begin by creating an image
$im = @imagecreatetruecolor ($width,$height);
//white background
$background_color = imagecolorallocate ($im, 255, 255, 255);
//black text
$text_color = imagecolorallocate ($im, 0 , 0, 0);
// put it all together
imagestring ($im, $font, 0, 0, $string, $text_color);
// and display
imagejpeg ($im);
?>