Don't blow up thumbnails if the image is smaller than 300x300.

This commit is contained in:
flash 2023-11-09 22:03:07 +00:00
parent 258fc4b6ba
commit 4304b956dd

View file

@ -133,9 +133,9 @@ class UploadsContext {
$imagick->setImageFormat('jpg');
$imagick->setImageCompressionQuality($this->config->getInteger('thumb:quality', 80));
$thumbRes = $this->config->getInteger('thumb:dimensions', 300);
$width = $imagick->getImageWidth();
$height = $imagick->getImageHeight();
$thumbRes = min($this->config->getInteger('thumb:dimensions', 300), $width, $height);
if($width === $height) {
$resizeWidth = $resizeHeight = $thumbRes;