]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add SGI and TGA preview support
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Fri, 22 Jan 2021 09:35:37 +0000 (10:35 +0100)
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Fri, 22 Jan 2021 09:42:51 +0000 (10:42 +0100)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
lib/private/Preview/SGI.php [new file with mode: 0644]
lib/private/Preview/TGA.php [new file with mode: 0644]
lib/private/PreviewManager.php
resources/config/mimetypealiases.dist.json
resources/config/mimetypemapping.dist.json

diff --git a/lib/private/Preview/SGI.php b/lib/private/Preview/SGI.php
new file mode 100644 (file)
index 0000000..2e19836
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @copyright 2021 John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OC\Preview;
+
+//.sgi
+class SGI extends Bitmap {
+       /**
+        * {@inheritDoc}
+        */
+       public function getMimeType(): string {
+               return '/image\/sgi/';
+       }
+}
diff --git a/lib/private/Preview/TGA.php b/lib/private/Preview/TGA.php
new file mode 100644 (file)
index 0000000..d29cb3e
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * @copyright 2021 John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OC\Preview;
+
+//.tga
+class TGA extends Bitmap {
+       /**
+        * {@inheritDoc}
+        */
+       public function getMimeType(): string {
+               return '/image\/t(ar)?ga/';
+       }
+}
index 1d65da8ca59d2798285c9e14dd92cb5113f11e5b..d6dc700e4a2ab23c6f025ed038231bb94a995304 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
  * @author Julius Härtl <jus@bitgrid.net>
  * @author Morris Jobke <hey@morrisjobke.de>
  * @author Olivier Paroz <github@oparoz.com>
@@ -379,6 +379,8 @@ class PreviewManager implements IPreview {
                                'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class],
                                'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class],
                                'HEIC' => ['mimetype' => '/image\/hei(f|c)/', 'class' => Preview\HEIC::class],
+                               'TGA' => ['mimetype' => '/image\/t(ar)?ga/', 'class' => Preview\TGA::class],
+                               'SGI' => ['mimetype' => '/image\/sgi/', 'class' => Preview\SGI::class],
                        ];
 
                        foreach ($imagickProviders as $queryFormat => $provider) {
index 332daea197bf13b16fc723a4b3f0d2524e7e791b..d02027619d63a34ba6fba252e8bca0aed0a2d93c 100644 (file)
        "application/internet-shortcut": "link",
        "application/km": "mindmap",
        "application/x-freemind": "mindmap",
-       "application/vnd.xmind.workbook": "mindmap"
+       "application/vnd.xmind.workbook": "mindmap",
+       "image/targa": "image/tga",
+       "image/targa": "image/tga"
 }
 
index 33e4ac016f9c213bcba4d2796f26046229043ad5..b38046aef32990b2069314a4424b8b15102a5583 100644 (file)
        "rw2": ["image/x-dcraw"],
        "schema": ["text/plain"],
        "sgf": ["application/sgf"],
+       "sgi": ["image/sgi"],
        "sh-lib": ["text/x-shellscript"],
        "sh": ["text/x-shellscript"],
        "srf": ["image/x-dcraw"],
        "tbz2": ["application/x-bzip2"],
        "tcx": ["application/vnd.garmin.tcx+xml"],
        "tex": ["application/x-tex"],
+       "tga": ["image/tga"],
        "tgz": ["application/x-compressed"],
        "tiff": ["image/tiff"],
        "tif": ["image/tiff"],