I think I’ve followed the instructions on responsive images
My portfolio images are 100% wide, inside a wrapper with a max-width of 2112px. Up to a viewport width of 2112px they fill the viewport (give or take a little padding).
Example here:
I’ve set up breakpoints at:
600px 900px 1500px 2112px.
My images do resize, but not at the viewport widths I expect.
For example, at viewport width 1501px I’d expect the image to be 2112px wide. Then at viewport 1500px width I’d expect the image to be 1500px wide.
But in browser developer tools my 1500px wide image is not kicking in until the viewport is 890px wide.
I’m using a bog-standard monitor, with a Device Pixel Ratio of 1. (Although it is plugged in to a MacBook with a high DPR – but I can’t imagine that would make any difference when not using the built in screen).
What’s going on?
<picture>
<source
srcset="<?= $file->srcset('webp') ?>"
sizes="(max-width: 2112px) 100vw, 2112px"
type="image/webp"
>
<img
alt="<?= $file->alt() ?>"
class="<?= $file->border() ?>"
src="<?= $file->url() ?>"
srcset="<?= $file->srcset() ?>"
sizes="(max-width: 2112px) 100vw, 2112px"
width="<?= $file->width() ?>"
height="<?= $file->height() ?>"
>
</picture>
Config.php file
<?php
return [
'debug' => false,
'thumbs' => [
'srcsets' => [
'default' => [
'600w' => ['width' => 600],
'900w' => ['width' => 900],
'1500w' => ['width' => 1500],
'2112w' => ['width' => 2112],
'2700w' => ['width' => 2700]
],
'webp' => [
'600w' => ['width' => 600, 'format' => 'webp'],
'900w' => ['width' => 900, 'format' => 'webp'],
'1500w' => ['width' => 1500, 'format' => 'webp'],
'2112w' => ['width' => 2112, 'format' => 'webp'],
'2700w' => ['width' => 2700, 'format' => 'webp']
]
]
]
];