[Embed] Only resize thumbnail if it's bigger than the desired size
This commit is contained in:
parent
233f731296
commit
bf885fbef8
|
@ -576,10 +576,10 @@ class EmbedPlugin extends Plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the image is not of the desired size, resize it
|
// 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
|
// Temporary object, not stored in DB
|
||||||
$img = new ImageFile(-1, $fullpath);
|
$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);
|
$outpath = $img->resizeTo($fullpath, $box);
|
||||||
$filename = basename($outpath);
|
$filename = basename($outpath);
|
||||||
if ($fullpath !== $outpath) {
|
if ($fullpath !== $outpath) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user