summaryrefslogtreecommitdiffstats
path: root/lib/private/Preview/Bitmap.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Preview/Bitmap.php')
-rw-r--r--lib/private/Preview/Bitmap.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/private/Preview/Bitmap.php b/lib/private/Preview/Bitmap.php
index 1fd42a0ea97..000b1f8277f 100644
--- a/lib/private/Preview/Bitmap.php
+++ b/lib/private/Preview/Bitmap.php
@@ -26,44 +26,43 @@
namespace OC\Preview;
use Imagick;
+use OCP\IImage;
use OCP\ILogger;
+use OCP\Files\File;
/**
* Creates a PNG preview using ImageMagick via the PECL extension
*
* @package OC\Preview
*/
-abstract class Bitmap extends Provider {
+abstract class Bitmap extends ProviderV2 {
/**
* {@inheritDoc}
*/
- public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
+ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage {
- $tmpPath = $fileview->toTmpFile($path);
- if (!$tmpPath) {
- return false;
- }
+ $tmpPath = $this->getLocalFile($file);
// Creates \Imagick object from bitmap or vector file
try {
$bp = $this->getResizedPreview($tmpPath, $maxX, $maxY);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, [
- 'message' => 'File: ' . $fileview->getAbsolutePath($path) . ' Imagick says:',
+ 'message' => 'File: ' . $file->getPath() . ' Imagick says:',
'level' => ILogger::ERROR,
'app' => 'core',
]);
- return false;
+ return null;
}
- unlink($tmpPath);
+ $this->cleanTmpFiles();
//new bitmap image object
$image = new \OC_Image();
$image->loadFromData($bp);
//check if image object is valid
- return $image->valid() ? $image : false;
+ return $image->valid() ? $image : null;
}
/**