aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Preview/ProviderV2.php
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-09-18 10:46:48 +0200
committerVincent Petry <vincent@nextcloud.com>2021-09-18 10:53:00 +0200
commit24e02553789ab16a731c752aa2990d01bd04e787 (patch)
treecf96bb734d403e60ac10ba9bbf0a7de81a42c00b /lib/private/Preview/ProviderV2.php
parenta46de28089df64047ec9ec1dd37b79a156d320b3 (diff)
downloadnextcloud-server-24e02553789ab16a731c752aa2990d01bd04e787.tar.gz
nextcloud-server-24e02553789ab16a731c752aa2990d01bd04e787.zip
Fall back to full file for video previews
If the first 5 MB are not enough to grab a useful frame for the thumbnail preview, fall back to reading the full file. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/private/Preview/ProviderV2.php')
-rw-r--r--lib/private/Preview/ProviderV2.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php
index e7cabd10337..1b5bee0e5cc 100644
--- a/lib/private/Preview/ProviderV2.php
+++ b/lib/private/Preview/ProviderV2.php
@@ -70,6 +70,10 @@ abstract class ProviderV2 implements IProviderV2 {
*/
abstract public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage;
+ protected function useTempFile(File $file) {
+ return $file->isEncrypted() || !$file->getStorage()->isLocal();
+ }
+
/**
* Get a path to either the local file or temporary file
*
@@ -78,8 +82,7 @@ abstract class ProviderV2 implements IProviderV2 {
* @return string
*/
protected function getLocalFile(File $file, int $maxSize = null): string {
- $useTempFile = $file->isEncrypted() || !$file->getStorage()->isLocal();
- if ($useTempFile) {
+ if ($this->useTempFile($file)) {
$absPath = \OC::$server->getTempManager()->getTemporaryFile();
$content = $file->fopen('r');