note 45300 deleted from function.imagetypes by tomsommer

From: Date: Wed, 01 Sep 2004 17:26:54 +0000
Subject: note 45300 deleted from function.imagetypes by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75853@lists.php.net to get a copy of this message
Note Submitter: Kiril ---- 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) }

« previous php.notes (#75853) next »