From 9977f0a676b6978ff94b25aa729f1ba8e1b2f276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 10 Jan 2018 16:34:23 +0100 Subject: [PATCH 1/2] [stable10] Add heic and heif as image mime types --- resources/config/mimetypemapping.dist.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/config/mimetypemapping.dist.json b/resources/config/mimetypemapping.dist.json index 789a16f4500c..854cef754e4f 100644 --- a/resources/config/mimetypemapping.dist.json +++ b/resources/config/mimetypemapping.dist.json @@ -51,6 +51,8 @@ "gz": ["application/x-gzip"], "gzip": ["application/x-gzip"], "h": ["text/x-h"], + "heic": ["image/heic"], + "heif": ["image/heif"], "hh": ["text/x-h"], "hpp": ["text/x-h"], "html": ["text/html", "text/plain"], From 1b62d28abe243a40a0278106b9da9babdbd8c6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Wed, 10 Jan 2018 16:49:22 +0100 Subject: [PATCH 2/2] [stable10] Adding Heic/Heif preview generators - needs an updated imagick https://github.com/ImageMagick/ImageMagick/issues/507 --- lib/private/Preview/Heic.php | 32 ++++++++++++++++++++++++++++++++ lib/private/PreviewManager.php | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 lib/private/Preview/Heic.php diff --git a/lib/private/Preview/Heic.php b/lib/private/Preview/Heic.php new file mode 100644 index 000000000000..6e7bba4125ff --- /dev/null +++ b/lib/private/Preview/Heic.php @@ -0,0 +1,32 @@ + + * + * @copyright Copyright (c) 2018, ownCloud GmbH + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see + * + */ + +namespace OC\Preview; + +//.psd +class Heic extends Bitmap { + /** + * {@inheritDoc} + */ + public function getMimeType() { + return '/image\/hei(f|c)/'; + } +} diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 30c06b728626..64bcae8f5737 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -243,6 +243,7 @@ protected function getEnabledDefaultProvider() { 'OC\Preview\JPEG', 'OC\Preview\GIF', 'OC\Preview\BMP', + 'OC\Preview\Heic', 'OC\Preview\XBitmap' ]; @@ -303,6 +304,7 @@ protected function registerCoreProviders() { 'PSD' => ['mimetype' => '/application\/x-photoshop/', 'class' => '\OC\Preview\Photoshop'], 'EPS' => ['mimetype' => '/application\/postscript/', 'class' => '\OC\Preview\Postscript'], 'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => '\OC\Preview\Font'], + 'HEIC' => ['mimetype' => '/image\/hei(f|c)/', 'class' => '\OC\Preview\Heic'], ]; foreach ($imagickProviders as $queryFormat => $provider) {