diff options
Diffstat (limited to 'lib/private/Preview/SVG.php')
-rw-r--r-- | lib/private/Preview/SVG.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/Preview/SVG.php b/lib/private/Preview/SVG.php index e283175c2e2..3f313f4bb9b 100644 --- a/lib/private/Preview/SVG.php +++ b/lib/private/Preview/SVG.php @@ -24,32 +24,34 @@ */ namespace OC\Preview; +use OCP\IImage; use OCP\ILogger; +use OCP\Files\File; -class SVG extends Provider { +class SVG extends ProviderV2 { /** * {@inheritDoc} */ - public function getMimeType() { + public function getMimeType(): string { return '/image\/svg\+xml/'; } /** * {@inheritDoc} */ - public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { + public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { try { $svg = new \Imagick(); $svg->setBackgroundColor(new \ImagickPixel('transparent')); - $content = stream_get_contents($fileview->fopen($path, 'r')); + $content = stream_get_contents($file->fopen('r')); if (substr($content, 0, 5) !== '<?xml') { $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; } // Do not parse SVG files with references if (stripos($content, 'xlink:href') !== false) { - return false; + return null; } $svg->readImageBlob($content); @@ -59,7 +61,7 @@ class SVG extends Provider { 'level' => ILogger::ERROR, 'app' => 'core', ]); - return false; + return null; } //new image object @@ -71,6 +73,6 @@ class SVG extends Provider { return $image; } - return false; + return null; } } |