From 114710c17ea69bbc3e0bb41e7c81c3da72cdc7fd Mon Sep 17 00:00:00 2001 From: Mansoor Khan <8mansoorkhan@gmail.com> Date: Thu, 31 Oct 2024 23:29:34 +0500 Subject: [PATCH] fix: add max-width (#8) * fix: add max-width * Update GlideImageGenerator.php --------- Co-authored-by: Ralph J. Smit <59207045+ralphjsmit@users.noreply.github.com> --- src/GlideImageGenerator.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/GlideImageGenerator.php b/src/GlideImageGenerator.php index 4b67185..7aca7b2 100644 --- a/src/GlideImageGenerator.php +++ b/src/GlideImageGenerator.php @@ -15,6 +15,7 @@ public function src(string $path, ?int $maxWidth = null, ?string $sizes = null, $attributes->setAttributes([ 'src' => $this->getSrcAttribute($path, $maxWidth), 'srcset' => $this->getSrcsetAttribute($path, $maxWidth), + 'style' => "max-width: {$this->getImageWidth($path)}px", ...$sizes !== null ? ['sizes' => $sizes] : [], ...$lazy ? ['loading' => 'lazy'] : [], ]);