diff --git a/src/GlideImageGenerator.php b/src/GlideImageGenerator.php index f077b9c..e9663e9 100644 --- a/src/GlideImageGenerator.php +++ b/src/GlideImageGenerator.php @@ -8,7 +8,7 @@ class GlideImageGenerator { - public function src(string $path, int $maxWidth = null, string $sizes = null): ComponentAttributeBag + public function src(string $path, int $maxWidth = null, string $sizes = null, bool $lazy = true): ComponentAttributeBag { $attributes = new ComponentAttributeBag(); @@ -16,6 +16,7 @@ public function src(string $path, int $maxWidth = null, string $sizes = null): C 'src' => $this->getSrcAttribute($path, $maxWidth), 'srcset' => $this->getSrcsetAttribute($path, $maxWidth), ...$sizes !== null ? ['sizes' => $sizes] : [], + ...$lazy ? ['loading' => 'lazy'] : [], ]); return $attributes;