Skip to content

Commit

Permalink
Add SGI and TGA preview support
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jan 22, 2021
1 parent 7989247 commit af4c91b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 1 deletion.
35 changes: 35 additions & 0 deletions lib/private/Preview/SGI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
*
* @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 <http://www.gnu.org/licenses/>
*
*/

namespace OC\Preview;

//.sgi
class SGI extends Bitmap {
/**
* {@inheritDoc}
*/
public function getMimeType(): string {
return '/image\/sgi/';
}
}
35 changes: 35 additions & 0 deletions lib/private/Preview/TGA.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Joas Schilling <coding@schilljs.com>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
*
* @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 <http://www.gnu.org/licenses/>
*
*/

namespace OC\Preview;

//.tga
class TGA extends Bitmap {
/**
* {@inheritDoc}
*/
public function getMimeType(): string {
return '/image\/t(ar)?ga/';
}
}
2 changes: 2 additions & 0 deletions lib/private/PreviewManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ protected function registerCoreProviders() {
'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) {
Expand Down
4 changes: 3 additions & 1 deletion resources/config/mimetypealiases.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
"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"
}

2 changes: 2 additions & 0 deletions resources/config/mimetypemapping.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
"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"],
Expand All @@ -177,6 +178,7 @@
"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"],
Expand Down

0 comments on commit af4c91b

Please sign in to comment.