I get a Call to undefined function mime_content_type() and after lookign around the net I found that this is deprecated and I should now use fileinfo.
I need help converting my code to the new standard. If I do that will the new standard work on the old servers?
Can anyone help me?
[php]function isImage($file) {
//image file types (extenstion => mime type)
$types = array(
‘png’ => ‘image/png’,
‘jpe’ => ‘image/jpeg’,
‘jpeg’ => ‘image/jpeg’,
‘jpg’ => ‘image/jpeg’,
‘gif’ => ‘image/gif’,
‘bmp’ => ‘image/bmp’,
‘ico’ => ‘image/vnd.microsoft.icon’,
‘tiff’ => ‘image/tiff’,
‘tif’ => ‘image/tiff’,
‘svg’ => ‘image/svg+xml’,
‘svgz’ => ‘image/svg+xml’,
);
$ext = substr(strrchr($file, ‘.’),1);
if (in_array($ext, array_keys($types)) && in_array(mime_content_type($file), $types)) {
return true;
}
return false;
}[/php]