Thumbnails: crop from original size if 2x is unavailable

This commit is contained in:
Aaron van Geffen 2022-07-07 14:54:00 +02:00
parent c0d69f7205
commit d8858c78bb

View File

@ -79,6 +79,8 @@ class Image extends Asset
if ((!isset($width) || $this->image_width >= $width * 2) && if ((!isset($width) || $this->image_width >= $width * 2) &&
(!isset($height) || $this->image_height >= $height * 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
$image_urls[2] = $this->getThumbnailUrl($this->image_width, $this->image_height, true);
} }
else else
$image_urls[1] = $this->getUrl(); $image_urls[1] = $this->getUrl();