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 ( 150100)
    or die (
"Cannot create a new GD image.");
$background_color ImageColorAllocate  ($im255 255255);
$text_color ImageColorAllocate  ($im233 1491);
ImageString  ($im1 55,  "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