News:

To still receiving newsletters from us please subscribe to our Newsletters:
http://tech.groups.yahoo.com/group/developers-Heaven/

Main Menu

Create image in runtime PHP: imagegif()

Started by admin, January 24, 2011, 06:34:07 AM

Previous topic - Next topic

admin

Sometimes we need to create an image in runtime without saving, just to display text or numbers that is usually used in the human verification.
it's very easy to use the following code and save it in a php file, say "image.php" then you can use this file as an image in your HTML code.

<?php

// Create a new image instance
$im imagecreatetruecolor(100100);

// Make the background white
imagefilledrectangle($im0099990xFFFFFF);

// Draw a text string on the image
imagestring($im34020'GD Library'0xFFBA00);

// Output the image to browser
header('Content-type: image/gif');

imagegif($im);
imagedestroy($im);

?>