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

This commit is contained in:
Aaron committed 2022-07-08 23:49:13 +02:00
1 parent 44bb501d13
commit 36a2779381
1 file changed
+4
+4
View File
@@ -74,6 +74,10 @@ 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);
// 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); $image_urls[2] = $this->getThumbnailUrl($width * 2, $height * 2, false);
} }
else else