Don't try to generate double-density thumbs for small images

This commit is contained in:
Aaron van Geffen 2022-07-07 14:05:33 +02:00
parent 54fb7ab410
commit b5edf09a69

View File

@ -74,7 +74,11 @@ class Image extends Asset
{ {
$thumbnail = new Thumbnail($this); $thumbnail = new Thumbnail($this);
$image_urls[1] = $this->getThumbnailUrl($width, $height, false); $image_urls[1] = $this->getThumbnailUrl($width, $height, false);
$image_urls[2] = $this->getThumbnailUrl($width * 2, $height * 2, false);
// Can we afford to generate double-density thumbnails as well?
if ((!isset($width) || $this->image_width >= $width * 2) &&
(!isset($height) || $this->image_height >= $height * 2))
$image_urls[2] = $this->getThumbnailUrl($width * 2, $height * 2, false);
} }
else else
$image_urls[1] = $this->getUrl(); $image_urls[1] = $this->getUrl();