Re: Detecting GD version
| From: | Andrew Brampton | Date: | Mon, 14 Oct 2002 00:46:57 +0000 |
| Subject: | Re: Detecting GD version | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-119823@lists.php.net to get a copy of this message | ||
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
>
>