From b9d112a4ef82a26af0a5d9744ae82f2ac6d2c027 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms <jan.hendrik.willms@uni-oldenburg.de> Date: Mon, 23 Feb 2015 13:25:52 +0100 Subject: [PATCH] fix mime type again (controller sets invalid mime type, this needs to be overwritten), re #1 --- classes/MarketImage.class.php | 2 +- controllers/myplugins.php | 2 +- controllers/presenting.php | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/MarketImage.class.php b/classes/MarketImage.class.php index 1e87af1..7fb8eae 100644 --- a/classes/MarketImage.class.php +++ b/classes/MarketImage.class.php @@ -45,7 +45,7 @@ class MarketImage extends SimpleORMap { public function outputImage() { $path = self::getImageDataPath() . "/" . $this->getId(); - header("Content-Type: " . mime_content_type($path)); + header("Content-Type: " . $this['mimetype']); header("Content-Disposition: inline; filename=" . $this['filename']); echo file_get_contents($path); } diff --git a/controllers/myplugins.php b/controllers/myplugins.php index d47da97..18b3958 100644 --- a/controllers/myplugins.php +++ b/controllers/myplugins.php @@ -112,7 +112,7 @@ class MypluginsController extends PluginController { $file = new MarketImage(); $file['plugin_id'] = $this->marketplugin->getId(); $file['filename'] = $name; - $file['mimetype'] = $files['type'][$index]; + $file['mimetype'] = mime_content_type($files['tmp_name'][$index]); $file['position'] = $position; $file->installFromPath($files['tmp_name'][$index]); $file->store(); diff --git a/controllers/presenting.php b/controllers/presenting.php index a79da24..7b113e3 100644 --- a/controllers/presenting.php +++ b/controllers/presenting.php @@ -155,7 +155,10 @@ class PresentingController extends PluginController { public function image_action($image_id) { $this->image = new MarketImage($image_id); + + $this->set_content_type($this->image['mimetype']); $this->image->outputImage(); + $this->render_nothing(); } -- GitLab