diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 02f5f221..a11c1620 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -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()); } /** diff --git a/core/util.inc.php b/core/util.inc.php index b1670b7e..a18b1923 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -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'; }