php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17912 getting info from gd.so
Submitted: 2002-06-21 15:54 UTC Modified: 2002-06-24 06:08 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: tit dot petric at telemach dot net Assigned: derick (profile)
Status: Closed Package: GD related
PHP Version: 4.2.1 OS: linux debian/mandrake
Private report: No CVE-ID: None
 [2002-06-21 15:54 UTC] tit dot petric at telemach dot net
im having trouble determinating to which version of GD gd.so was linked to, phpinfo() only shows the acctual version of gd.so, but not the version of GD it was linked to..

some variable to show the acctual gd version (major and minor) would be nice, so i and other people would know how to dynamically use image* functions according to that variable, because setting up each server with platform-dependant code is a bit time consuming, and coding two different image libraries or graphing libraries which use GD is also a waste of time, if just a few functions change their names and behaviour.

example would be..

if ($GD_VERSION=='1') {
  imagecopyresized(...);
} else {
  imagecopyresampled(...);
}

be a sweetheart and add that :* (otherwise excelent work)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-21 15:57 UTC] rasmus@php.net
phpinfo() does show the GD version.  Between versions 1.6 and 1.8 there was no way to distinguish, so it is approximate, but other versions should be shown just fine.  As for figuring out which image types are available, use imagetypes()
 [2002-06-21 16:16 UTC] tit dot petric at telemach dot net
hmm in phpinfo() in the gd section the module info says gd 1.6.2 or higher, and i jumped to conclusion that this is what the module itself supports (since i have gd1.9.something), and didnt check if there is a seperate module for gd2 (which i doubt there is, meaning the version reply should stay the same or am i wrong?)

is there any way to get this number without having to parse/grep phpinfo(), something like a variable $IMG_* (nothing acctual system-level listed in there yet)

p.s. congrats on the baby rasmus (a bit late, but better than never :))
 [2002-06-21 16:21 UTC] rasmus@php.net
Why do you want the version?  Isn't it the capabilities you are interested in?  imagetypes() would give you that.  The version tells you next to nothing since every version of GD can be compiled differently.  ie. with or without ttf, png, jpg, gif, etc.
 [2002-06-21 16:32 UTC] tit dot petric at telemach dot net
well, that would only tell me which filetypes are supported, and not which functions, as you see copyimageresized() and copyimageresampled() are perfect examples of the differences between gd1 and gd2 (or advancements)

more accurate comparison would be "imagecreate" in gd1 and "imagecreatetruecolor" in gd2

(note the first comment posted on http://www.php.net/manual/en/function.imagecolorallocate.php where it also specifies this difference)

there are a lot of difference between gd1 and gd2 and this problem comes out of supporting both, since the api differs for each one.

p.s. i tried to solve this problem with function_exists("imagecreatetruecolor") but that always returns true, and after i call it it says i need GD2.0 or higher (which is the truth)
 [2002-06-21 16:33 UTC] tit dot petric at telemach dot net
p.s. in case i wasnt clear... by "supporting both" i ment, not supporting each one seperately (a module for gd and a module for gd2)
 [2002-06-24 04:02 UTC] sniper@php.net
The fix would be to make the functions be only available
when they are available..I guess that's what you're gonna do, Derick?


 [2002-06-24 05:30 UTC] derick@php.net
Yup, and i'm almost done ... testing now :)
 [2002-06-24 06:06 UTC] tit dot petric at telemach dot net
this will make function_exists("imagecreatetruecolor"); return true or false respectively, weather you have gd2.0 or not, correct?
 [2002-06-24 06:08 UTC] derick@php.net
Correct, and as I'm about to commit it, I close this 'bug' too.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 14:01:32 2024 UTC