note 15920 deleted from function.imagetypes by jimw
| From: | jimw@php.net | Date: | Fri, 07 Dec 2001 21:54:56 +0000 |
| Subject: | note 15920 deleted from function.imagetypes by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22044@lists.php.net to get a copy of this message | ||
Nope, it's a feature... :)
The function returns a bitmask, wich is the product of the IMG_* stuff...
When I run this function, I get 14, wich is IMG_JPG + IMG_PNG + IMG_WBMP (2+4+8), wich is correct,
since I don't have gif support (with gif, I'd get 15).
Here are 2 simple functions to get the available types, or to check if a type is supported:
function _get_image_types () {
$i = ImageTypes();
$r['WBMP'] = ($i >= 8) ? TRUE:FALSE;
$i -= 8;
$r['PNG'] = ($i >= 4) ? TRUE:FALSE;
$i -= 4;
$r['JPG'] = ($i >= 2) ? TRUE:FALSE;
$i -= 2;
$r['GIF'] = ($i >= 1) ? TRUE:FALSE;
return $r;
}
function is_imgtype ($t = "PNG) {
$i = _get_image_types();
return $i[$t];
}
Sjon.
PS: This could be done more efficiently, I think...