note 57263 added to function.image-type-to-extension
| From: | robe at amd dot co dot at | Date: | Wed, 28 Sep 2005 19:31:08 +0000 |
| Subject: | note 57263 added to function.image-type-to-extension | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95938@lists.php.net to get a copy of this message | ||
neil: your version fails to make sense for me
spybreak.de guy:
a) you left out BMP
b) you fucked up the order of the extension in the mid of the listing. if this was changed in the
getimagesize function during php versions, I'm sorry. Otherwise: WHY?!
c) the include_dot stuff is the worst abuse of function arguments I've ever seen. Shame on you.
Here's a unfucked, working version:
<?
if(!function_exists('image_type_to_extension'))
{
function image_type_to_extension($imagetype)
{
if(empty($imagetype)) return false;
switch($imagetype)
{
case IMAGETYPE_GIF : return 'gif';
case IMAGETYPE_JPEG : return 'jpg';
case IMAGETYPE_PNG : return 'png';
case IMAGETYPE_SWF : return 'swf';
case IMAGETYPE_PSD : return 'psd';
case IMAGETYPE_BMP : return 'bmp';
case IMAGETYPE_TIFF_II : return 'tiff';
case IMAGETYPE_TIFF_MM : return 'tiff';
case IMAGETYPE_JPC : return 'jpc';
case IMAGETYPE_JP2 : return 'jp2';
case IMAGETYPE_JPX : return 'jpf';
case IMAGETYPE_JB2 : return 'jb2';
case IMAGETYPE_SWC : return 'swc';
case IMAGETYPE_IFF : return 'aiff';
case IMAGETYPE_WBMP : return 'wbmp';
case IMAGETYPE_XBM : return 'xbm';
default : return false;
}
}
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.image-type-to-extension.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57263
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57263&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57263&report=yes
Search -- http://master.php.net/manage/user-notes.php