Don't generate max preview twice

If you request a preview of X by Y. And after calculating X and Y are
equal to maxWidth and maxHeight then there is no reason to create a
preview of that size.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/3924/head
Roeland Jago Douma 9 years ago
parent 6677963902
commit 4cd13e7668
No known key found for this signature in database
GPG Key ID: F941078878347C0C
  1. 5
      lib/private/Preview/Generator.php

@ -111,6 +111,11 @@ class Generator {
// Calculate the preview size
list($width, $height) = $this->calculateSize($width, $height, $crop, $mode, $maxWidth, $maxHeight);
// No need to generate a preview that is just the max preview
if ($width === $maxWidth && $height === $maxHeight) {
return $maxPreview;
}
// Try to get a cached preview. Else generate (and store) one
try {
$file = $this->getCachedPreview($previewFolder, $width, $height, $crop);

Loading…
Cancel
Save