Contents Previous Next

3.1.2 Verifying that you have GD2 installed

To access the more advanced features of JpGraph needs the GD 2.x library. This will allow the use of features such as alpha-blending and trucolor images.

The GD 2.x library is included in all standard PHP versions from 4.2.x and above. To make sure that the GD 2.x library is installed the following script must be working.

 $im  imagecreatetruecolor ( 300200); 
$black imagecolorallocate ($im 000 ); 
$white imagecolorallocate ($im 255255255 ); 

imagefilledrectangle ($im,0, 0,399,99 ,$white); 
imagerectangle ($im,20, 20,250,190 ,$black); 

header ("Content-type: image/png" ); 
imagepng ($im);

After running this script you should now see a black rectangle in your browser.

Contents Previous Next