Now this is something funny! I wanted to check the version of GD in my development machine. As I was right in the middle of php coding, I just did a quick print_r(gd_info()). And what did I get?
Array
(
[GD Version] => 2.0 or higher
[FreeType Support] => 1
[FreeType Linkage] => with freetype
[T1Lib Support] => 1
[GIF Read Support] => 1
[GIF Create Support] => 1
[JPG Support] => 1
[PNG Support] => 1
[WBMP Support] => 1
[XPM Support] =>
[XBM Support] =>
[JIS-mapped Japanese Font Support] =>
)hmmm yeah, 2.0 or higher, very useful information! Specially considering it’s been in 2.x for years now!
Had to go to Synaptic to exactly determine which version is installed. But I wonder if there’s another way of finding out the version without having access to the system’s package manager, for example when one is in a shared host and all that?
If anybody knows, please post a comment :-)

Akas84
Maybe with these:
phpinfo(INFO_MODULES);
$gd=ob_get_contents();
ob_end_clean();
preg_match(‘%GD Version(.*)class=”v”>(.*)%siU’, $gd, $gd);
$version=preg_replace(‘%[^0-9\.]%’, ”, $gd[1]);
echo $version;
Pedro Cardoso
Olá!
I got “GD Version bundled (2.0.34 compatible)” out of phpinfo() on my Mac Mini.
Will this do the trick?
sole
Thanks both!
I’ll try with the phpinfo trick.
Jcl
I don’t think there’s a way. phpinfo() is likely to get the same version number as gd_info() (should give “2.0 or higher” on your machine, with phpinfo()).
Then again, the main difference (apart from bugfixes) in GD versions is the use of truecolor functions or not (which is = 2.0 thing), so I don’t think it’s all that important to get the exact version :-)
If you want to get the number from gd_info() (that’s how I check for version 2 or later for using truecolor):
$arr = gd_info();
$ver = ereg_replace(‘[[:alpha:][:space:]()]+’, ”, $arr['GD Version']);