Skip to content

Commit

Permalink
feat: ability to let images grow past their full size
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjsmit committed Dec 26, 2024
1 parent 114710c commit 7747172
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GlideImageGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

class GlideImageGenerator
{
public function src(string $path, ?int $maxWidth = null, ?string $sizes = null, bool $lazy = true): ComponentAttributeBag
public function src(string $path, ?int $maxWidth = null, ?string $sizes = null, bool $lazy = true, bool $grow = false): ComponentAttributeBag
{
$attributes = new ComponentAttributeBag();

$attributes->setAttributes([
'src' => $this->getSrcAttribute($path, $maxWidth),
'srcset' => $this->getSrcsetAttribute($path, $maxWidth),
'style' => "max-width: {$this->getImageWidth($path)}px",
...$grow ? [] : ['style' => "max-width: {$this->getImageWidth($path)}px"],
...$sizes !== null ? ['sizes' => $sizes] : [],
...$lazy ? ['loading' => 'lazy'] : [],
]);
Expand Down

0 comments on commit 7747172

Please sign in to comment.