Save a GD image in PHP

Description

The following code shows how to save a GD image.

Example


<?php/*  w  ww .  j a  v  a  2 s .c o  m*/
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);

// Save the gd image
// The file format for GD images is .gd, see http://www.libgd.org/GdFileFormats
imagegd($im, 'simple.gd');

// Free up memory
imagedestroy($im);
?>




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text