diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-04-05 11:00:57 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-04-08 16:24:10 +0200 |
commit | a2e671c489528a935c7a4e186188f84ea2b3058e (patch) | |
tree | 49ed1c4503facd90d2dd767ac3d3b85c7ec98de7 /lib | |
parent | 0734582c062da9dad11562c68730d4e752b08acd (diff) | |
download | nextcloud-server-a2e671c489528a935c7a4e186188f84ea2b3058e.tar.gz nextcloud-server-a2e671c489528a935c7a4e186188f84ea2b3058e.zip |
Extract preview from opendocument files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/OpenDocument.php | 17 | ||||
-rw-r--r-- | lib/private/PreviewManager.php | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/lib/private/Preview/OpenDocument.php b/lib/private/Preview/OpenDocument.php index b795441d837..1db7b0be521 100644 --- a/lib/private/Preview/OpenDocument.php +++ b/lib/private/Preview/OpenDocument.php @@ -25,11 +25,26 @@ namespace OC\Preview; //.odt, .ott, .oth, .odm, .odg, .otg, .odp, .otp, .ods, .ots, .odc, .odf, .odb, .odi, .oxt -class OpenDocument extends Office { +use OCP\Files\File; +use OCP\IImage; + +class OpenDocument extends Bundled { /** * {@inheritDoc} */ public function getMimeType(): string { return '/application\/vnd.oasis.opendocument.*/'; } + + + /** + * @inheritDoc + */ + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { + $image = $this->extractThumbnail($file, 'Thumbnails/thumbnail.png'); + if ($image->valid()) { + return $image; + } + return null; + } } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 652a442deec..ab20ccdfbbe 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -300,6 +300,7 @@ class PreviewManager implements IPreview { Preview\MarkDown::class, Preview\MP3::class, Preview\TXT::class, + Preview\OpenDocument::class, ], $imageProviders)); if (in_array(Preview\Image::class, $this->defaultProviders)) { @@ -340,6 +341,7 @@ class PreviewManager implements IPreview { $this->registerCoreProvider(Preview\BMP::class, '/image\/bmp/'); $this->registerCoreProvider(Preview\XBitmap::class, '/image\/x-xbitmap/'); $this->registerCoreProvider(Preview\MP3::class, '/audio\/mpeg/'); + $this->registerCoreProvider(Preview\OpenDocument::class, '/application\/vnd.oasis.opendocument.*/'); // SVG, Office and Bitmap require imagick if (extension_loaded('imagick')) { |