Friday, September 17, 2010

Create a Simple Image in PHP

Below is the function to manipulate a simple image in true color

this function will create a simple image set its header return image and free the memory by destroying it.

function createImage($imgw, $imgh)
{
// create a image
$image = imagecreatetruecolor($imgw, $imgh);
# Prints out all the figures and picture and frees memory
header('Content-type: image/png');
ImagePNG($image);
imagedestroy($image);
}

No comments: