diff --git a/CHANGELOG.md b/CHANGELOG.md index d64e05f9..6190d060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # ImageOptimize Changelog +## 1.6.1 - 2019.08.13 +### Changed +* Added more robust sanity checking if an invalid URL or path is being passed into `ImageTransform::appendExtension()` + ## 1.6.0 - 2019.07.05 ### Added * Added support for Sharp via [AWS Serverless Image Handler](https://aws.amazon.com/solutions/serverless-image-handler/) as a Transform Method diff --git a/README.md b/README.md index dbd9d78d..5f7ba268 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,7 @@ If you wish to dynamically create Optimized Image Variants in your templates wit To create Optimized Image Variants dynamically in your templates, you can do: ``` -{% set optimzedImages = craft.imageOptimize.createOptimizedImages( +{% set optimizedImages = craft.imageOptimize.createOptimizedImages( someAsset, [ { @@ -220,7 +220,7 @@ To create Optimized Image Variants dynamically in your templates, you can do: All of these fields are required, and they are analogous to the settings provided by the Field. The `retinaSizes` is an array of multipliers for the retina variants. For instance, if we wanted both normal resolution and 2x variants of the above image, we'd do: ``` -{% set optimzedImages = craft.imageOptimize.createOptimizedImages( +{% set optimizedImages = craft.imageOptimize.createOptimizedImages( someAsset, [ { @@ -240,7 +240,7 @@ All of these fields are required, and they are analogous to the settings provide You can create as many Optimized Image Variants as you like, by just including another array of settings. For example, to create both 200x and 400x image variants, we could do: ``` -{% set optimzedImages = craft.imageOptimize.createOptimizedImages( +{% set optimizedImages = craft.imageOptimize.createOptimizedImages( someAsset, [ { @@ -271,7 +271,7 @@ The `optimizedImages` object that is returned to you can be used in your templat **N.B.:** Because they are lengthy operations, by default the generation of the dominant color palette and the generation of the placeholder silhouette are off. You can enable them via an additional parameter passed down to `craft.imageOptimize.createOptimizedImages`: ``` -{% set optimzedImages = craft.imageOptimize.createOptimizedImages( +{% set optimizedImages = craft.imageOptimize.createOptimizedImages( someAsset, [ { diff --git a/composer.json b/composer.json index a3ab93b4..8744f0e5 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "nystudio107/craft-imageoptimize", "description": "Automatically create & optimize responsive image transforms, using either native Craft transforms or a service like Imgix, with zero template changes.", "type": "craft-plugin", - "version": "1.6.0", + "version": "1.6.1", "keywords": [ "craft", "cms", diff --git a/src/imagetransforms/ImageTransform.php b/src/imagetransforms/ImageTransform.php index 62c07dce..6b7e9be1 100644 --- a/src/imagetransforms/ImageTransform.php +++ b/src/imagetransforms/ImageTransform.php @@ -143,7 +143,7 @@ public function appendExtension($pathOrUrl, $extension): string { $path = $this->decomposeUrl($pathOrUrl); $path_parts = pathinfo($path['path']); - $new_path = $path_parts['filename'] . '.' . $path_parts['extension'] . $extension; + $new_path = ($path_parts['filename'] ?? '') . '.' . ($path_parts['extension'] ?? '') . $extension; if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') { $new_path = $path_parts['dirname'] . DIRECTORY_SEPARATOR . $new_path; $new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path);