mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-09 21:45:29 +00:00
Fix #161: Replace deprecated mime_content_type() with finfo_file() when available
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user