Contents Previous Next

### 3.1.1 Verifying that you have the GD library installed

In order to make sure that the GD installed the following example would be run. The example creates a very simple image using just pure GD calls and outputs an image in PNG format. This could be considered a smoke-test to see that the GD library is available from PHP. Please note that this is an absolute pre-requisite in order for the JpGraph library to work at all.

Store the code snippet below somewhere in the document root and make sure it runs correctly.

`$im = @ ImageCreate ( 150, 100)
or die ( "Cannot create a new GD image.");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5, "A Simple Text String", $text_color );
header ("Content-type: image/png");
ImagePng ($im);`

If the above script does not work or some error or warnings are printed on the screen then it is necessary to correct those problems before proceeding with the installation.

Contents Previous Next