Drop in replacement for image_type_to_extension should work in PHP 4
PHP Code:
if ( !function_exists('image_type_to_extension') ) {
function image_type_to_extension ( $type, $dot = true )
{
$e = array ( 1 => 'gif', 'jpeg', 'png', 'swf', 'psd', 'bmp'
'tiff', 'tiff', 'jpc', 'jp2', 'jpf', 'jb2', 'swc',
'aiff', 'wbmp', 'xbm' );
// We are expecting an integer.
$type = (int)$type;
if ( !$type ) {
trigger_error( '...come up with an error here...', E_USER_NOTICE );
return null;
}
if ( !isset( $e[ $type ] ) ) {
trigger_error( '...come up with an error here...' E_USER_NOTICE );
return null;
}
return ( $dot ? '.' : '' ) . $e[ $type ];
}
}
Bookmarks