diff --git a/app/Util/Media/Image.php b/app/Util/Media/Image.php index cbc1efe67..dc6608c08 100644 --- a/app/Util/Media/Image.php +++ b/app/Util/Media/Image.php @@ -72,6 +72,8 @@ class Image return [ 'dimensions' => $this->orientations()[$orientation], 'orientation' => $orientation, + 'width_original' => $width, + 'height_original' => $height, ]; } @@ -157,9 +159,11 @@ class Image $media->metadata = json_encode($meta); } - $img->resize($aspect['width'], $aspect['height'], function ($constraint) { - $constraint->aspectRatio(); - }); + if ( ($ratio['width_original'] > $aspect['width']) || ($ratio['height_original'] > $aspect['height']) ) { + $img->resize($aspect['width'], $aspect['height'], function ($constraint) { + $constraint->aspectRatio(); + }); + } } $converted = $this->setBaseName($path, $thumbnail, $img->extension); $newPath = storage_path('app/'.$converted['path']);