[drupal-devel] New image.module

Stefan Nagtegaal Drupal-Devel at Frontaal-Online.com
Mon Feb 28 09:20:50 UTC 2005


Stefan Nagtegaal schreef:

> James Walker schreef:
>
>> On 27-Feb-05, at 7:28 AM, Stefan Nagtegaal wrote:
>>
>>> After having studied more and more of the new image(-api|.module), i 
>>> have some concerns, which are:
>>> - We currently assume that everybody has at least GD 2.0, which is a 
>>> bad thing imo.
>>>  Imo we should move the GD 2.0 functions like 
>>> image_gd_(settings|resize|rotate|crop|open|close) into a separate 
>>> image.gd2.inc and make a image.gd1.inc file. just like we did for 
>>> the ImageMagick, which currently lives in silence under Walkah's 
>>> Sandbox...
>>
>>
>>
>> We don't actually make any assumptions about GD version. If you'll 
>> notice all of the "gd2-only" functions are wrapped by 
>> 'function_exists' calls, and fall back on the gd1 versions if not 
>> defined. I'm pretty sure this fails gracefully... If you're seeing a 
>> *specific* issue with handling under gd1 handling, then I'd be more 
>> than happy to patch it. We do however, only include gd* by default 
>> (as gd2 is bundled with recent php). imagemagick, etc will be 
>> available as well as an extra download.
>
>
> Well, I have 2 hosts currently.. I tried to run the image.module with 
> a standard image.inc on a host with GD 1.6.2 
> (http://frontaal-online.com/phpinfo.php) where it is failing to work.. 
> It looks like the function imageCreateTrueColor is known, but is not 
> present nor working..
> So, it fails to work..
> I still would like to see the image.module split into 3 files.
> - image.inc
> - image.gd1.inc &
> - image.gd2.inc.
>
> then we can leave the image.inc in core, so the api is present. But 
> whenever people would like to have image manipulation capabilities, 
> they downoad the image.$toolkit.inc file which matches their needs.

okay, I just found out why this isn't working..
 From the PHP manual:
"|Actually GD <2.0 had imagecreattruecolor, it just didn't work :P|", 
which explains why it doesn't work as expected.. the function_exists() 
finds the code, so the else clause after the if 
(function_exists('imageCreateTrueColor')) { get never executed..

I'll come up with a patch soon, to compromise the behaviour.. Though, I 
still think it's better to have separate files for the gd1 and gd2 image 
manipulation toolkits..

thoughts???




Stefan



More information about the drupal-devel mailing list