diff --git a/src/Imgix/UrlHelper.php b/src/Imgix/UrlHelper.php index 1800a13..9ed66b3 100644 --- a/src/Imgix/UrlHelper.php +++ b/src/Imgix/UrlHelper.php @@ -71,7 +71,7 @@ public function getURL() { if (substr($key, -2) == '64') { $encodedVal = self::base64url_encode($val); } else { - $encodedVal = rawurlencode($val); + $encodedVal = is_array($val) ? rawurlencode(implode(',',$val)) : rawurlencode($val); } $queryPairs[] = rawurlencode($key) . "=" . $encodedVal; diff --git a/tests/Imgix/Tests/UrlBuilderTest.php b/tests/Imgix/Tests/UrlBuilderTest.php index 2f20757..b0f3201 100644 --- a/tests/Imgix/Tests/UrlBuilderTest.php +++ b/tests/Imgix/Tests/UrlBuilderTest.php @@ -124,5 +124,12 @@ public function testInclusionOfLibraryVersionParam() { $this->assertEquals("https://demos.imgix.net/https%3A%2F%2Fmy-demo-site.com%2Ffiles%2F133467012%2Favatar%20icon.png%3Fsome%3Dchill%26params%3D1?ixlib=php-" . $version, $url); } + public function testNestedParameters(){ + $builder = new UrlBuilder("demos.imgix.net", true, "", ShardStrategy::CRC, false); + $params = array("auto" => array("compress","format")); + $url = $builder->createURL("bridge.png", $params); + + $this->assertEquals("https://demos.imgix.net/bridge.png?auto=compress%2Cformat", $url); + } } ?>