To: mail at spybreak dot de
I noted  your solution was for mime_type_to_extension which is flawed because the MIME types to extensions are not unique. See my example to consider what I have observed.
This function performs image type or mime type to extension. With limitation it will not attempt to handle duplicated MIME types. NOT DEFINITIVE!
<?php
    if(!function_exists('image_type_to_extension')){       
        $extension;
        function image_type_or_mime_type_to_extension($image_type, $include_dot) {
            define ("INVALID_IMAGETYPE", '');
            
            $extension = INVALID_IMAGETYPE;            $image_type_identifiers = array (                                                                array (IMAGETYPE_GIF         => 'gif',     "mime_type" => 'image/gif'),                        array (IMAGETYPE_JPEG        => 'jpg',     "mime_type" => 'image/jpeg'),                        array (IMAGETYPE_PNG        => 'png',     "mime_type" => 'image/png'),                        array (IMAGETYPE_SWF        => 'swf',     "mime_type" => 'application/x-shockwave-flash'),    array (IMAGETYPE_PSD        => 'psd',     "mime_type" => 'image/psd'),                        array (IMAGETYPE_BMP        => 'bmp',     "mime_type" => 'image/bmp'),                        array (IMAGETYPE_TIFF_II    => 'tiff',     "mime_type" => 'image/tiff'),                        array (IMAGETYPE_TIFF_MM    => 'tiff',     "mime_type" => 'image/tiff'),                        array (IMAGETYPE_JPC        => 'jpc',     "mime_type" => 'application/octet-stream'),            array (IMAGETYPE_JP2        => 'jp2',     "mime_type" => 'image/jp2'),                        array (IMAGETYPE_JPX        => 'jpf',     "mime_type" => 'application/octet-stream'),            array (IMAGETYPE_JB2        => 'jb2',     "mime_type" => 'application/octet-stream'),            array (IMAGETYPE_SWC        => 'swc',     "mime_type" => 'application/x-shockwave-flash'),    array (IMAGETYPE_IFF        => 'aiff',     "mime_type" => 'image/iff'),                        array (IMAGETYPE_WBMP        => 'wbmp',     "mime_type" => 'image/vnd.wap.wbmp'),                array (IMAGETYPE_XBM        => 'xbm',     "mime_type" => 'image/xbm')                            );                                                                                    
            
            if((is_int($image_type)) AND (IMAGETYPE_GIF <= $image_type) AND (IMAGETYPE_XBM >= $image_type)){
                $extension = $image_type_identifiers[$image_type-1]; $extension = $extension[$image_type];
            }
            elseif(is_string($image_type) AND (($image_type != 'application/x-shockwave-flash') OR ($image_type != 'application/octet-stream'))){                
            
                $extension =  match_mime_type_to_extension($image_type, $image_type_identifiers);
            }
            else
            {
                $extension = INVALID_IMAGETYPE;
            }
               if(is_bool($include_dot)){
                   if((false != $include_dot) AND (INVALID_IMAGETYPE != $extension)){
                       $extension = '.' . $extension;
                   }
               }
               else
               {
                   $extension = INVALID_IMAGETYPE;
               }                  
       
           return $extension;
           }
    }    
    function match_mime_type_to_extension($image_type, $image_type_identifiers){
        foreach($image_type_identifiers as $_key_outer_loop => $_val_outer_loop){            
            foreach($_val_outer_loop as $_key => $_val){
                if(is_int ($_key)){             $extension = $_val;
                } 
                if($_key == 'mime_type'){    
                    if($_val === $image_type){    return $extension;        }                     
                }
            }
        }
        return $extension = INVALID_IMAGETYPE;    
    } 
    
    $extension = image_type_or_mime_type_to_extension($image_type, $include_dot);
     return $extension;
}
?>