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>
This commit is contained in:
parent
6677963902
commit
4cd13e7668
|
@ -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…
Reference in New Issue