diff --git a/src/Contracts/Imaging/UrlBuilder.php b/src/Contracts/Imaging/UrlBuilder.php index 937df59503..4ea839f27e 100644 --- a/src/Contracts/Imaging/UrlBuilder.php +++ b/src/Contracts/Imaging/UrlBuilder.php @@ -9,8 +9,7 @@ interface UrlBuilder * * @param \Statamic\Contracts\Assets\Asset|string $item * @param array $params - * @param string|null $filename * @return string */ - public function build($item, $params, $filename = null); + public function build($item, $params); } diff --git a/src/Imaging/GlideImageManipulator.php b/src/Imaging/GlideImageManipulator.php index 31a468d1f7..8c4589a52d 100644 --- a/src/Imaging/GlideImageManipulator.php +++ b/src/Imaging/GlideImageManipulator.php @@ -31,13 +31,6 @@ class GlideImageManipulator implements ImageManipulator */ protected $item_type; - /** - * A custom filename. - * - * @var string|null - */ - protected $filename; - /** * Methods available in Glide's API. * @@ -106,20 +99,7 @@ public function item($item) */ public function build() { - return $this->builder->build($this->item, $this->params, $this->filename); - } - - /** - * Set a custom filename. - * - * @param string $filename - * @return $this - */ - public function filename($filename) - { - $this->filename = $filename; - - return $this; + return $this->builder->build($this->item, $this->params); } /** diff --git a/src/Imaging/GlideUrlBuilder.php b/src/Imaging/GlideUrlBuilder.php index fe7afa2068..36916511b2 100644 --- a/src/Imaging/GlideUrlBuilder.php +++ b/src/Imaging/GlideUrlBuilder.php @@ -30,26 +30,20 @@ public function __construct(array $options = []) * * @throws \Exception */ - public function build($item, $params, $filename = null) + public function build($item, $params) { $this->item = $item; + $filename = null; + switch ($this->itemType()) { case 'url': $path = 'http/'.base64_encode($item); - - if (! $filename) { - $filename = Str::afterLast($item, '/'); - } - + $filename = Str::afterLast($item, '/'); break; case 'asset': $path = 'asset/'.base64_encode($this->item->containerId().'/'.$this->item->path()); - - if (! $filename) { - $filename = Str::afterLast($this->item->path(), '/'); - } - + $filename = Str::afterLast($this->item->path(), '/'); break; case 'id': $path = 'asset/'.base64_encode(str_replace('::', '/', $this->item)); diff --git a/src/Imaging/StaticUrlBuilder.php b/src/Imaging/StaticUrlBuilder.php index de9e4f9f37..87bf8984d5 100644 --- a/src/Imaging/StaticUrlBuilder.php +++ b/src/Imaging/StaticUrlBuilder.php @@ -44,10 +44,9 @@ public function __construct(ImageGenerator $generator, array $options = []) * * @param \Statamic\Contracts\Assets\Asset|string $item * @param array $params - * @param string|null $filename * @return string */ - public function build($item, $params, $filename = null) + public function build($item, $params) { $this->item = $item; $this->params = $params; diff --git a/tests/Imaging/GlideUrlBuilderTest.php b/tests/Imaging/GlideUrlBuilderTest.php index 1ebd12b5e3..a1dcb42df6 100644 --- a/tests/Imaging/GlideUrlBuilderTest.php +++ b/tests/Imaging/GlideUrlBuilderTest.php @@ -72,14 +72,6 @@ public function testId() ); } - public function testFilename() - { - $this->assertEquals( - '/img/foo.jpg/custom.png?w=100', - $this->builder->build('/foo.jpg', ['w' => '100'], 'custom.png') - ); - } - public function testConfigAddsFilename() { $asset = new Asset;