From df0c2c895cda7f01bbb756dc292db79a3e2a7183 Mon Sep 17 00:00:00 2001 From: Ben Croker <57572400+bencroker@users.noreply.github.com> Date: Sun, 29 Dec 2024 09:03:41 -0600 Subject: [PATCH] Fix srcset width filtering --- src/models/OptimizedImage.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/models/OptimizedImage.php b/src/models/OptimizedImage.php index 2d269e0..92e4f4e 100644 --- a/src/models/OptimizedImage.php +++ b/src/models/OptimizedImage.php @@ -618,8 +618,7 @@ 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 the source widths by numeric key sort($this->variantSourceWidths, SORT_NUMERIC); foreach ($this->variantSourceWidths as $variantSourceWidth) { $match = false;