summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/image.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-01-04 10:00:07 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-01-07 11:41:54 +0100
commit5b216500976019734e67b3edd8b17c8e18c9c8cc (patch)
tree317639e279432da92108fcd980883c664f932210 /lib/private/legacy/image.php
parentf25e51c3691e8dce3c0f6c8ed56f4effa9ebb0dc (diff)
downloadnextcloud-server-5b216500976019734e67b3edd8b17c8e18c9c8cc.tar.gz
nextcloud-server-5b216500976019734e67b3edd8b17c8e18c9c8cc.zip
Don't lie about the preview mimetype
For legacy reasons we stored all the previews with a png extention. However we did not put png data in them all the time. This caused the preview endpoints to always report that a preview is a png file. Which was a lie. Since we abstract away from the storage etc in the previewmanager. There is no need anymore to store them as .png files and instead we can use the actual file extention. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/legacy/image.php')
-rw-r--r--lib/private/legacy/image.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php
index a7d702ac032..925548ef26d 100644
--- a/lib/private/legacy/image.php
+++ b/lib/private/legacy/image.php
@@ -305,6 +305,24 @@ class OC_Image implements \OCP\IImage {
}
/**
+ * @return null|string Returns the mimetype of the data
+ */
+ public function dataMimeType() {
+ if (!$this->valid()) {
+ return null;
+ }
+
+ switch ($this->mimeType) {
+ case 'image/png':
+ case 'image/jpeg':
+ case 'image/gif':
+ return $this->mimeType;
+ default:
+ return 'image/png';
+ }
+ }
+
+ /**
* @return null|string Returns the raw image data.
*/
public function data() {