Create a new image from GD file or URL in PHP

Description

The following code shows how to create a new image from GD file or URL.

Example


<?php/*  ww  w  .  j a v  a2 s. com*/
// Load the gd image
$im = @imagecreatefromgd('./test.gd');

// Test if the image was loaded
if(!is_resource($im))
{
     die('Unable to load gd image!');
}

// Do image operations here

// Save the image
imagegd($im, './test_updated.gd');
imagedestroy($im);
?>

The code above generates the following result.

Create a new image from GD file or URL in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text