Re: Detecting GD version
| From: | Owen Prime | Date: | Mon, 14 Oct 2002 00:56:52 +0000 |
| Subject: | Re: Detecting GD version | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119824@lists.php.net to get a copy of this message | ||
Been there. The function still exists in GD < 2.0. Thats why it produces
such a specific error message. Otherwise it would say function doesn't
exist.
Thanks for you input anyways.
Cheers,
Owen Prime
http://www.noggin.com.au
Andrew Brampton wrote:
> try function_exists('imagecopyresampled');
>
> otherwise I'm sure there has to be some function that returns versions of
> libs.
>
> Andrew
> ----- Original Message -----
> From: "Owen Prime" <owen@noggin.com.au>
> To: <php-general@lists.php.net>
> Sent: Monday, October 14, 2002 1:37 AM
> Subject: [PHP] Detecting GD version
>
>
>> Has anyone got any better ideas about how to detect what version of GD is
>> running other than the following. The reason I ask is that I want to use
>> imagecopyresampled() only if available ie. GD >= v2.0.
>>
>> OPTION 1.
>> Parse phpinfo() output for the GD version info. Expensive.
>>
>> OPTION 2.
>> Run imagecopyresampled() suppressing errors and then check the error msg.
>> ie:
>> @imagecopyresampled();
>> if ($php_errormsg != "imagecopyresampled(): requires GD 2.0 or later")
>> // GD >= v2.0
>> } else {
>> // GD < v2.0
>> }
>>
>> Option 2 is the best I can come up with at the moment.... luckily the
>> "requires GD 2.0" error message is triggered before the argument
> validation
>> errors.
>>
>> Anyone got a better idea?
>>
>> Thanks,
>>
>> Owen Prime
>> http://www.noggin.com.au
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>