[PHP] GD GIF or PNG Detect Part 2

2001-10-29 Thread Chris

I received good advice from my previous question:
Before creating a graphic, I would like to detect what type of graphic
files are supported. For example if GD is enabled and GIF Support is
available I'll create an GIF image. I know phpinfo() will tell me this
but I don't want to burden the user with this check.

I implemented the following:
if (ImageTypes()  IMG_GIF)
{
echo GIF support enabled;
}
elseif (ImageTypes()  IMG_PNG)
{
echo PNG support enabled;
else
{
echo This install of PHP does NOT support graphics creation;
}

However when there are no GD libraries installed the following error is
thrown:
Fatal error: Call to undefined function: imagetypes()…

Any suggestions to prevent the error message being thrown. Are there
other methods to detect the presence GD libraries before testing for GIF
or PNG support?


Regards,
Chris





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] GD GIF or PNG Detect Part 2

2001-10-29 Thread Daniel Reichenbach

 However when there are no GD libraries installed the 
 following error is
 thrown:
 Fatal error: Call to undefined function: imagetypes()…
 
 Any suggestions to prevent the error message being thrown. Are there
 other methods to detect the presence GD libraries before 
 testing for GIF
 or PNG support?
How about using something like this?

if (function_exists('ImageTypes')) {
// GD functions are available
} else {
// GD functions not available
}

http://www.php.net/manual/en/function.function-exists.php is the place
in the manual :)

Daniel



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]