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.
<?Php
if (extension_loaded('gd')) {
echo "<br>GD support is  loaded ";
}else{
echo "<br>GD support is NOT loaded ";
}
if(function_exists('gd_info')){
echo "<br>GD function support is available ";
}else{
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()
<?Php
$a=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

* indicates required
Subscribe to plus2net

    plus2net.com







    GD functions in PHP for handling images & graphics

    How to check GD support in PHP
    Header for an image in browser
    Drawing of graphic lines using GD
    Plotting line graph by drawing data from table
    Adding vertical grid to line graph
    Adding rectangles using imagerectangle()
    Imagearc drawing arc and circle
    Imagefilledarc drawing filled arc and circle
    Resizing and adding border to Images
    Script for Watermarking image on the fly using PHP GD
    Generate image by using user input form data
    john

    21-06-2013

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

    28-10-2013

    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.
    susanta

    03-06-2014

    i have problem in showing graph from html table.it is only showing small image icon.how to fix it
    yogesh

    15-03-2015

    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.
    smo

    16-03-2015

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

    Post your comments , suggestion , error , requirements etc here




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