Extract preview from opendocument files
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
0734582c06
commit
a2e671c489
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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')) {
|
||||
|
|
Loading…
Reference in New Issue