From d1b29eef0a1026fe873887c2b9d9c9b353df9ac8 Mon Sep 17 00:00:00 2001 From: edalzell Date: Thu, 9 Jan 2025 13:33:42 -0800 Subject: [PATCH] Allow options to be set on the glide builder --- src/Contracts/Imaging/ImageManipulator.php | 2 +- src/Contracts/Imaging/UrlBuilder.php | 2 ++ src/Imaging/GlideImageManipulator.php | 4 ++-- src/Imaging/GlideUrlBuilder.php | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Contracts/Imaging/ImageManipulator.php b/src/Contracts/Imaging/ImageManipulator.php index 6a7b9a5d8c..43acd3e051 100644 --- a/src/Contracts/Imaging/ImageManipulator.php +++ b/src/Contracts/Imaging/ImageManipulator.php @@ -11,7 +11,7 @@ interface ImageManipulator * * @return mixed */ - public function build(); + public function build(array $options = []); /** * Set the item to be manipulated. diff --git a/src/Contracts/Imaging/UrlBuilder.php b/src/Contracts/Imaging/UrlBuilder.php index 4ea839f27e..5d895e1d67 100644 --- a/src/Contracts/Imaging/UrlBuilder.php +++ b/src/Contracts/Imaging/UrlBuilder.php @@ -12,4 +12,6 @@ interface UrlBuilder * @return string */ public function build($item, $params); + + public function options(array $options = []): self; } diff --git a/src/Imaging/GlideImageManipulator.php b/src/Imaging/GlideImageManipulator.php index 8c4589a52d..8215cb57d8 100644 --- a/src/Imaging/GlideImageManipulator.php +++ b/src/Imaging/GlideImageManipulator.php @@ -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); } /** diff --git a/src/Imaging/GlideUrlBuilder.php b/src/Imaging/GlideUrlBuilder.php index 5b34bf9e1d..5b1ee2c4c1 100644 --- a/src/Imaging/GlideUrlBuilder.php +++ b/src/Imaging/GlideUrlBuilder.php @@ -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; + } }