Fix #161: Replace deprecated mime_content_type() with finfo_file() when available

This commit is contained in:
Zach Borboa
2015-04-01 16:41:50 -07:00
parent 343252cfdf
commit bfe5b2fed4
2 changed files with 18 additions and 2 deletions
+16
View File
@@ -56,3 +56,19 @@ function get_png()
file_put_contents($tmp_filename, create_png());
return $tmp_filename;
}
if (function_exists('finfo_open')) {
function mime_type($file_path)
{
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime_type = finfo_file($finfo, $file_path);
finfo_close($finfo);
return $mime_type;
}
} else {
function mime_type($file_path)
{
$mime_type = mime_content_type($file_path);
return $mime_type;
}
}