diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d3a868..2b68f2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # ImageOptimize Changelog +## 5.0.2 - 2024.06.19 +### Fixed +* Fixed an issue where `srcsetMaxWidth()` could return incorrect results ([#407](https://github.com/nystudio107/craft-imageoptimize/issues/407)) +* Fixed an issue where the data-uri for inline SVG styles were incorrect in some browsers because the spaces were not URL-encoded ([#408](https://github.com/nystudio107/craft-imageoptimize/issues/408)) + ## 5.0.1 - 2024.05.09 ### Fixed * Fixed an issue where field content was not propagated to other sites on multi-site installs, causing missing images diff --git a/composer.json b/composer.json index e139e47..af72d9e 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": "5.0.1", + "version": "5.0.2", "keywords": [ "craft", "cms", diff --git a/src/models/OptimizedImage.php b/src/models/OptimizedImage.php index 32c2133..3480446 100644 --- a/src/models/OptimizedImage.php +++ b/src/models/OptimizedImage.php @@ -618,6 +618,9 @@ protected function getSrcsetSubsetArray(array $set, int $width, string $comparis if (empty($this->variantSourceWidths)) { return $subset; } + // Sort the arrays by numeric key + ksort($set, SORT_NUMERIC); + sort($this->variantSourceWidths, SORT_NUMERIC); foreach ($this->variantSourceWidths as $variantSourceWidth) { $match = false; switch ($comparison) { diff --git a/src/services/OptimizedImages.php b/src/services/OptimizedImages.php index 0878129..6b40830 100644 --- a/src/services/OptimizedImages.php +++ b/src/services/OptimizedImages.php @@ -429,8 +429,6 @@ public function encodeOptimizedSVGDataUri(string $uri): string $replacements = [ // remove newlines '/%0A/' => '', - // put spaces back in - '/%20/' => ' ', // put equals signs back in '/%3D/' => '=', // put colons back in