[drupal-devel] [bug] image.gd.inc isn't compatible with gd 1

Dries drupal-devel at drupal.org
Sun Mar 13 08:54:57 UTC 2005

Issue status update for http://drupal.org/node/18700

 Project:      Drupal
-Version:      4.5.2
+Version:      cvs
 Component:    base system
 Category:     bug reports
 Priority:     critical
 Assigned to:  stefan nagtegaal
 Reported by:  stefan nagtegaal
 Updated by:   Dries
 Status:       patch

What versions of PHP have those old GD toolkits?
PHP 4.3.10 comes with GD 2.0.28, it seems, as does PHP 5.0.3.
PHP 4.3.3, Drupal's current minimum PHP requirement, comes with GD
>From the looks, we don't need GD 1 handling at all ... (but we might
need a global version check).


Previous comments:

March 10, 2005 - 20:13 : stefan nagtegaal

The idea behind the image.gd.inc file is that it should be usable for
people who are using GD 1 and GD 2.
Unfortunatly, the way it is written now, only support for GD 2 can be
given because:
Current way of determining GD 2, is not right:
if (function_exists('imageCreateTrueColor')) {
  // GD 2 Handling;
else {
  // GD 1 Handling
this doesn't work.. imageCreateTrueColor() was already implemented in
GD 1, only it failed to work properly..
See these pages:
http://www.php.net/imagecratetruecolor#25234 &
According to this comments, we should implement this like this:
// Silence errors using the @
$image = @imageCreateTrueColor(......);
if (!$image) {
  // GD 1 Handling;


March 11, 2005 - 20:03 : stefan nagtegaal

Attachment: http://drupal.org/files/issues/image-inc.patch (2.26 KB)

Attached patch improves:
- the way which deals with the detection of GD 1 or GD 2;
- error messages as reported by Steven here:
After applying this to HEAD/Drupal 4.6 RC, we can close the following
- http://drupal.org/node/17645;
- http://drupal.org/node/13027;
Please test/comment and apply attached patch..


March 12, 2005 - 10:41 : Dries

Isn't the approach taking in http://drupal.org/node/13027 nicer?  It
doesn't surpress warnings/errors.  Maybe that approach doesn't work?


March 12, 2005 - 10:50 : Bèr Kessels

-1 on supressing errors with @. Its ugly, and hardly used in Drupal. We
should use our own error handling at all times.


March 12, 2005 - 11:42 : stefan nagtegaal

I will make a new patch, with the more elegant approach you mentioned


March 12, 2005 - 19:05 : stefan nagtegaal

As noticed before in this issue.. The function imageCreateTrueColor
_does_ exist, even in versions of GD before 1.8 only it was broken..
So, function_exist() doesn't work on that the function, because it
really _does_ exist, but the fact is that it's simply broken..
So unfortunatly, the more elegant solution doesn't seem to work..


March 12, 2005 - 20:01 : pz

Stupid question, why not just use the gd_info function?

More information about the drupal-devel mailing list