Skip to content

Commit

Permalink
Allow options to be set on the glide builder
Browse files Browse the repository at this point in the history
  • Loading branch information
edalzell committed Jan 9, 2025
1 parent bcd529b commit d1b29ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Contracts/Imaging/ImageManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ImageManipulator
*
* @return mixed
*/
public function build();
public function build(array $options = []);

/**
* Set the item to be manipulated.
Expand Down
2 changes: 2 additions & 0 deletions src/Contracts/Imaging/UrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ interface UrlBuilder
* @return string
*/
public function build($item, $params);

public function options(array $options = []): self;
}
4 changes: 2 additions & 2 deletions src/Imaging/GlideImageManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ public function item($item)
*
* @return mixed
*/
public function build()
public function build(array $options = [])
{
return $this->builder->build($this->item, $this->params);
return $this->builder->options($options)->build($this->item, $this->params);
}

/**
Expand Down
7 changes: 7 additions & 0 deletions src/Imaging/GlideUrlBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,11 @@ public function build($item, $params)

return URL::prependSiteRoot($builder->getUrl($path, $params));
}

public function options(array $options = []): self
{
$this->options = array_merge($this->options, $options);

return $this;
}
}

0 comments on commit d1b29ee

Please sign in to comment.