Forum

Thread tagged as: Question

RWD images: Changing image sizes use case

I am using the solution mentioned above from your documentation. Strange that always the smallest image available is shown even in browsers that support srcset... Any idea why? Thanks a lot!

Martin Stettler

Martin Stettler 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example of what you're doing and how it's failing?

Of course. On all mobile devices I always see the smallest (320px) image

<div class="item<perch:if exists="perch_item_first"> active</perch:if>">
    <img src="<perch:content type="image" id="image" label="Bild" bucket="Slideshows" help="Size 1200px x  500px" />" alt="<perch:content type="text" id="alt" label="Name" required="true" help="SEO relevant!" title="true" />"
sizes="100vw"
srcset="<perch:content type="image" id="image" label="Image" width="320" /> 320w,
        <perch:content type="image" id="image" label="Image" width="480" /> 480w,
        <perch:content type="image" id="image" label="Image" width="768" /> 768w,
        <perch:content type="image" id="image" label="Image" width="1200" /> 1200w">
</div>

Many thanks!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the output you're getting incorrect, or is this a web dev question?

Yes, the output is correct. Right, it should be a web dev problem...