Re: bug in Cache/Graphics.php
| From: | Joao Prado Maia | Date: | Mon, 24 Sep 2001 01:01:29 +0000 |
| Subject: | Re: bug in Cache/Graphics.php | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1998@lists.php.net to get a copy of this message | ||
On Sun, 23 Sep 2001, Tomas V.V.Cox wrote:
> Martin Jansen wrote:
> >
> > On Sun, 23 Sep 2001 09:17:18 +0200, Andreas Kossmeier wrote:
> >
> > >line 238 (and 293) in Cache/Graphics.php
> > >
> > >: // generate the image
> > >: $func = 'Image' . strtoupper($format);
> > >: $func($img);
> > >: ImageDestroy($img);
> > >
>
> At least a is_function($func) would be more than recomended. In the
> other hand, PHP use case insensitive function names so the strtoupper is
> not needed.
>
That's not good enough. The GD module always defines the Image***
functions, and it is only when you try to use a function to generate an
image that is not supported by GD that the warning shows up.
The correct way to check for GIF/PNG/JPEG support is by using
ImageTypes(), as described in the manual:
http://www.php.net/manual/en/function.imagetypes.php
Just my .2c,
Joao
--
João Prado Maia <jpm@phpbrasil.com>
http://phpbrasil.com - php com um jeitinho brasileiro
--
Precisando de consultoria em desenvolvimento para a Internet ?
Impleo.net - http://impleo.net/?lang=br