|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
4
|
|
|
* |
|
5
|
|
|
* @author Joas Schilling <[email protected]> |
|
6
|
|
|
* @author Robin Appelman <[email protected]> |
|
7
|
|
|
* @author Roeland Jago Douma <[email protected]> |
|
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
|
|
|
//.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt |
|
28
|
|
|
use OCP\Files\File; |
|
29
|
|
|
use OCP\IImage; |
|
30
|
|
|
|
|
31
|
|
|
class OpenDocument extends Bundled { |
|
32
|
|
|
/** |
|
33
|
|
|
* {@inheritDoc} |
|
34
|
|
|
*/ |
|
35
|
|
|
public function getMimeType(): string { |
|
36
|
|
|
return '/application\/vnd.oasis.opendocument.*/'; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @inheritDoc |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { |
|
44
|
|
|
$image = $this->extractThumbnail($file, 'Thumbnails/thumbnail.png'); |
|
45
|
|
|
if ($image->valid()) { |
|
46
|
|
|
return $image; |
|
47
|
|
|
} |
|
48
|
|
|
return null; |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|