GD Support enable and checking

GD library support is required in PHP to manage graphics and images. This is a power full tool to draw graphs, diagrams on the fly and create attractive animations. You can create banners and buttons on the fly using GD library support.

We can enable or disable any support by working on php.ini file. Search for this file in your system and open it. You will find a line like this shown in the picture and check that your remove ; before this to make gd support enable.
We will try some steps here to identify GD support is enabled or not. Mostly PHP 4 and higher versions comes with GD support. Some time it may not be enabled. To know this we can use phpinfo function and check GD support is available or not. Here is an image of what phpinfo function displays in a GD enabled system.

The above image displayed by phpinfo function shows that GD support is enabled in the php system and ready to use.

Testing GD support by Script

By using php code we can check GD support. For this we will be using function_exists and extension_loaded functions. Here is the code.
if (extension_loaded('gd')) {
echo "<br>GD support is  loaded ";
echo "<br>GD support is NOT loaded ";
echo "<br>GD function support is available ";
echo "<br>GD function support is NOT available ";

Displaying GD support available

We can display the type of GD support available in PHP installation. We can see whether GIF support or any other support is available or not. Here is the code to display gd_info()
while (list ($key, $val) = each ($a)) { 
echo "$key -> $val <br>"; 
The output of above code is here.
GD Version -> bundled (2.1.0 compatible) 
FreeType Support -> 1 
FreeType Linkage -> with freetype 
T1Lib Support -> 
GIF Read Support -> 1 
GIF Create Support -> 1 
JPEG Support -> 1 
PNG Support -> 1 
WBMP Support -> 1 
XPM Support -> 1 
XBM Support -> 1 
JIS-mapped Japanese Font Support -> 

GD functions
Subscribe to our YouTube Channel here


* indicates required
Subscribe to plus2net



    i have tried the code but it displays a small image icon- wat may be the problem


    After scouring the web I finally figured out how to fix the problem myself. Basically GD was not showing under PHPINFO and the reason was that for some reason my extension files had different Windows permissions set. I fixed it by resetting the permissions and making sure that the IUSR account has all the access it needed.


    i have problem in showing graph from html is only showing small image to fix it


    i tried the above given solution of enabling the gd library by removing the semicolon in php.ini file however when i check using phpinfo function , no gd support is shown.


    what is the php version you are using, must be very old.

    Post your comments , suggestion , error , requirements etc here

    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 All rights reserved worldwide Privacy Policy Disclaimer