when checking mime types, use the filename.ext from the DB, not the (non-existent) .ext on disk
This commit is contained in:
parent
bbe2b1dc46
commit
06426bdfe6
2 changed files with 2 additions and 3 deletions
|
@ -387,7 +387,7 @@ class Image {
|
|||
* @retval string
|
||||
*/
|
||||
public function get_mime_type() {
|
||||
return getMimeType($this->get_image_filename());
|
||||
return getMimeType($this->get_image_filename(), $this->get_ext());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -489,7 +489,7 @@ function captcha_check() {
|
|||
* @param string &$file File path
|
||||
* @return string
|
||||
*/
|
||||
function getMimeType($file) {
|
||||
function getMimeType($file, $ext="") {
|
||||
$type = false;
|
||||
// Fileinfo documentation says fileinfo_open() will use the
|
||||
// MAGIC env var for the magic file
|
||||
|
@ -527,7 +527,6 @@ function getMimeType($file) {
|
|||
'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
|
||||
'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php'
|
||||
);
|
||||
$ext = strtolower(pathInfo($file, PATHINFO_EXTENSION));
|
||||
return isset($exts[$ext]) ? $exts[$ext] : 'application/octet-stream';
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue