Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I think there is an issue with commit 3862ee3.
That patch replaced line 1578 in the theme_image_srcset() function with this:
$key = (int) ((float) drupal_substr($src['multiplier'], -1) * 100);
Which always equals zero (0) when run on a multipler like '1x', '2x', or '3x' because the drupal_substr()
function always outputs the last character: 'x'. So the $srcsets
array always overwrites itself at key zero.
I'm not really sure why the code was changed from what was there before which seems like the safest approach since it doesn't clash with the width key on line 1574:
$key = $src['multiplier'];
Comment | File | Size | Author |
---|---|---|---|
#3 | i2614378-3.patch | 595 bytes | attiks |
#2 | picture-multiplier-keys-always-equal-zero-2614378-2.patch | 494 bytes | Daniel Korte |
Comments
Comment #2
Daniel KorteAttached patch reverts commit 3862ee3 at line 1578.
Comment #3
attiks CreditAttribution: attiks at Attiks commentedNew patch, we need the float to handle the 1.5x
Comment #5
attiks CreditAttribution: attiks at Attiks commentedCommitted to dev, thanks