Installing GD image manipulation capabilities in PHP on Ubuntu 11.04

I wanted to enable the image manipulation functions using Php. It was documented that the that GD library is included in Php versions 4.3 and above. I had PHP version 5.3.5 on my Ubuntu 11.04.

I tested the GD support using the code:

[php]
< ?php echo "GD Info :
“;
var_dump(gd_info());

if (imagetypes() & IMG_PNG) {
echo “PNG Support is enabled”;
}
?>[/php]

I found out the the GD extension had to be enabled in the PHP.ini file (which can be found at /etc/php5/apache2/php.ini ). I had to add the following line

[shell]extension=gd.so;[/shell]

Then restart the Apache server :

[shell]sudo /etc/init.d/apache2 restart [/shell]

Then I tested the GD support again and I confirmed that it works !

[text]
GD Info
array(12) { [“GD Version”]=> string(3) “2.0” [“FreeType Support”]=> bool(true) [“FreeType Linkage”]=> string(13) “with freetype” [“T1Lib Support”]=> bool(true) [“GIF Read Support”]=> bool(true) [“GIF Create Support”]=> bool(true) [“JPEG Support”]=> bool(true) [“PNG Support”]=> bool(true) [“WBMP Support”]=> bool(true) [“XPM Support”]=> bool(false) [“XBM Support”]=> bool(false) [“JIS-mapped Japanese Font Support”]=> bool(false) } PNG Support is enabled
[/text]

Leave a comment

Your email address will not be published. Required fields are marked *