Skip to content

Commit

Permalink
Generate all preview sizes for Imaginary
Browse files Browse the repository at this point in the history
A follow up on nextcloud#40670

Based on discussions here: nextcloud#38911 (comment)

This fixes the case were not all previews are generated, for example in the activity view: nextcloud#38911 (comment)



Signed-off-by: Daniel Hansson <[email protected]>
  • Loading branch information
enoch85 authored and zak39 committed Dec 19, 2023
1 parent d8a429b commit df9e52e
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/private/Preview/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,6 @@ public function generatePreviews(File $file, array $specifications, $mimeType =
$previewVersion = $file->getPreviewVersion() . '-';
}

// If imaginary is enabled, and we request a small thumbnail,
// let's not generate the max preview for performance reasons
if (count($specifications) === 1
&& ($specifications[0]['width'] <= 256 || $specifications[0]['height'] <= 256)
&& preg_match(Imaginary::supportedMimeTypes(), $mimeType)
&& $this->config->getSystemValueString('preview_imaginary_url', 'invalid') !== 'invalid') {
$crop = $specifications[0]['crop'] ?? false;
$preview = $this->getSmallImagePreview($previewFolder, $previewFiles, $file, $mimeType, $previewVersion, $crop);

if ($preview->getSize() === 0) {
$preview->delete();
throw new NotFoundException('Cached preview size 0, invalid!');
}

return $preview;
}

// Get the max preview and infer the max preview sizes from that
$maxPreview = $this->getMaxPreview($previewFolder, $previewFiles, $file, $mimeType, $previewVersion);
$maxPreviewImage = null; // only load the image when we need it
Expand Down

0 comments on commit df9e52e

Please sign in to comment.