diff options
Diffstat (limited to 'lib/private/legacy/image.php')
-rw-r--r-- | lib/private/legacy/image.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index 120b19d1cff..d132c0e3fd9 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -318,6 +318,25 @@ class OC_Image implements \OCP\IImage { } /** + * @return string Returns the mimetype of the data. Returns the empty string + * if the data is not valid. + */ + public function dataMimeType() { + if (!$this->valid()) { + return ''; + } + + 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() { |