Wednesday, August 18, 2010

Create an image on the fly with the GD library

Run the following code to create an image on the fly:
header ("Content-type: image/png");
$im = @imagecreate (150, 50)
or die ("Sorry Couldn't create image!");
$background_color = imagecolorallocate ($im, 205, 205, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 2, 5, 5, "Your demo text goes here", $text_color);
imagepng ($im);
imagedestroy($im);

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off