note 45300 added to function.imagetypes
| From: | Kiril at osu1 dot php dot net | Date: | Wed, 01 Sep 2004 15:35:25 +0000 |
| Subject: | note 45300 added to function.imagetypes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-75845@lists.php.net to get a copy of this message | ||
Or This Function:
<?php
function getSupportedImageTypes()
{
$types = array( 'gif' => IMG_GIF, 'jpg' => IMG_JPG, 'png'
=> IMG_PNG, 'wbmp' => IMG_WBMP, 'xpm' => IMG_XPM );
array_walk( $types, create_function( '&$v', '$v = (bool)( imagetypes() &
$v );' ) );
return $types;
}
?>
OR For A Class:
<?php
class MyGD
{
var $img_support = array( 'gif' => IMG_GIF, 'jpg' => IMG_JPG,
'png' => IMG_PNG, 'wbmp' => IMG_WBMP, 'xpm' => IMG_XPM );
// Constructor
function MyGD()
{
array_walk( $this -> img_support, create_function( '&$v', '$v =
(bool)( imagetypes() & $v );' ) );
}
}
?>
RETURNS (Apache/2.0.49 (Win32) PHP/4.3.7 GD Version/bundled (2.0.23 compatible)):
With (bool) Type Cast:
array(5) { ["gif"]=> bool(false) ["jpg"]=> bool(true)
["png"]=> bool(true) ["wbmp"]=> bool(true) ["xpm"]=>
bool(false) }
Without (bool) Type Cast:
array(5) { ["gif"]=> int(0) ["jpg"]=> int(2) ["png"]=> int(4)
["bmp"]=> int(8) ["xpm"]=> int(0) }
----
Manual Page -- http://www.php.net/manual/en/function.imagetypes.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45300
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45300&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45300&report=yes
Search -- http://master.php.net/manage/user-notes.php