[Embed] Only resize thumbnail if it's bigger than the desired size

This commit is contained in:
Miguel Dantas 2019-08-19 01:41:19 +01:00 committed by Diogo Peralta Cordeiro
parent 233f731296
commit bf885fbef8

View File

@ -576,10 +576,10 @@ class EmbedPlugin extends Plugin
}
// If the image is not of the desired size, resize it
if ($info[0] !== $this->thumbnail_width || $info[1] !== $this->thumbnail_height) {
if ($info[0] > $this->thumbnail_width || $info[1] > $this->thumbnail_height) {
// Temporary object, not stored in DB
$img = new ImageFile(-1, $fullpath);
$box = $img->scaleToFit($width, $height, $this->thumbnail_crop);
$box = $img->scaleToFit($this->thumbnail_width, $this->thumbnail_height, $this->thumbnail_crop);
$outpath = $img->resizeTo($fullpath, $box);
$filename = basename($outpath);
if ($fullpath !== $outpath) {