diff --git a/classes/ImageResizer.php b/classes/ImageResizer.php index 6faa6eb..9d02241 100644 --- a/classes/ImageResizer.php +++ b/classes/ImageResizer.php @@ -60,20 +60,21 @@ class ImageResizer { $return = collect([]); $ratios = collect(); - $ratios->push($this->dimensions()); + $dimensions = $this->dimensions(); + $ratios->push($dimensions); $ratios = $ratios->merge($this->sizes()); - foreach (collect(Setting::get('breakpoints'))->push($this->dimensions()->get('width'))->unique() as $size) { + foreach (collect(Setting::get('breakpoints'))->push($dimensions->get('width'))->unique() as $size) { foreach ($ratios as $ratio) { $width = $size; $height = $size * $ratio->get('height') / $ratio->get('width'); - if ($height > $this->dimensions()->get('height')) { - $width = $width * $this->dimensions()->get('height') / $height; - $height = $this->dimensions()->get('height'); + if ($height > $dimensions->get('height')) { + $width = $width * $dimensions->get('height') / $height; + $height = $dimensions->get('height'); } - if (ceil($width) > $this->dimensions()->get('width') || ceil($height) > $this->dimensions()->get('height')) { + if (ceil($width) > $dimensions->get('width') || ceil($height) > $dimensions->get('height')) { continue; }