Skip to content

Commit af4c91b

Browse files
committed
Add SGI and TGA preview support
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
1 parent 7989247 commit af4c91b

5 files changed

Lines changed: 77 additions & 1 deletion

File tree

lib/private/Preview/SGI.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2016, ownCloud, Inc.
4+
*
5+
* @author Joas Schilling <coding@schilljs.com>
6+
* @author Morris Jobke <hey@morrisjobke.de>
7+
* @author Robin Appelman <robin@icewind.nl>
8+
*
9+
* @license AGPL-3.0
10+
*
11+
* This code is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License, version 3,
13+
* as published by the Free Software Foundation.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License, version 3,
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>
22+
*
23+
*/
24+
25+
namespace OC\Preview;
26+
27+
//.sgi
28+
class SGI extends Bitmap {
29+
/**
30+
* {@inheritDoc}
31+
*/
32+
public function getMimeType(): string {
33+
return '/image\/sgi/';
34+
}
35+
}

lib/private/Preview/TGA.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* @copyright Copyright (c) 2016, ownCloud, Inc.
4+
*
5+
* @author Joas Schilling <coding@schilljs.com>
6+
* @author Morris Jobke <hey@morrisjobke.de>
7+
* @author Robin Appelman <robin@icewind.nl>
8+
*
9+
* @license AGPL-3.0
10+
*
11+
* This code is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License, version 3,
13+
* as published by the Free Software Foundation.
14+
*
15+
* This program is distributed in the hope that it will be useful,
16+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Affero General Public License for more details.
19+
*
20+
* You should have received a copy of the GNU Affero General Public License, version 3,
21+
* along with this program. If not, see <http://www.gnu.org/licenses/>
22+
*
23+
*/
24+
25+
namespace OC\Preview;
26+
27+
//.tga
28+
class TGA extends Bitmap {
29+
/**
30+
* {@inheritDoc}
31+
*/
32+
public function getMimeType(): string {
33+
return '/image\/t(ar)?ga/';
34+
}
35+
}

lib/private/PreviewManager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ protected function registerCoreProviders() {
379379
'EPS' => ['mimetype' => '/application\/postscript/', 'class' => Preview\Postscript::class],
380380
'TTF' => ['mimetype' => '/application\/(?:font-sfnt|x-font$)/', 'class' => Preview\Font::class],
381381
'HEIC' => ['mimetype' => '/image\/hei(f|c)/', 'class' => Preview\HEIC::class],
382+
'TGA' => ['mimetype' => '/image\/t(ar)?ga/', 'class' => Preview\TGA::class],
383+
'SGI' => ['mimetype' => '/image\/sgi/', 'class' => Preview\SGI::class],
382384
];
383385

384386
foreach ($imagickProviders as $queryFormat => $provider) {

resources/config/mimetypealiases.dist.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
"application/internet-shortcut": "link",
105105
"application/km": "mindmap",
106106
"application/x-freemind": "mindmap",
107-
"application/vnd.xmind.workbook": "mindmap"
107+
"application/vnd.xmind.workbook": "mindmap",
108+
"image/targa": "image/tga",
109+
"image/targa": "image/tga"
108110
}
109111

resources/config/mimetypemapping.dist.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@
165165
"rw2": ["image/x-dcraw"],
166166
"schema": ["text/plain"],
167167
"sgf": ["application/sgf"],
168+
"sgi": ["image/sgi"],
168169
"sh-lib": ["text/x-shellscript"],
169170
"sh": ["text/x-shellscript"],
170171
"srf": ["image/x-dcraw"],
@@ -177,6 +178,7 @@
177178
"tbz2": ["application/x-bzip2"],
178179
"tcx": ["application/vnd.garmin.tcx+xml"],
179180
"tex": ["application/x-tex"],
181+
"tga": ["image/tga"],
180182
"tgz": ["application/x-compressed"],
181183
"tiff": ["image/tiff"],
182184
"tif": ["image/tiff"],

0 commit comments

Comments
 (0)