• Resolved Gal Baras

    (@galbaras)


    This site uses JS WEBP, if this makes any difference.

    In the section About the Author, the image of the author is embedded like this:

    <img class="alignleft wp-image-13401" src="https://www.ronitbaras.com/wp-content/uploads/2015/10/ronit-baras-269x350.png" alt="Ronit Baras" width="230" height="300">

    When lazy load is off, this creates an IMG tag with sizes="(max-width: 230px) 100vw, 230px". You can see this on https://www.ronitbaras.com/books/printed-books/reflections/.

    When lazy load is on, we get instead sizes="495px" and the image is displayed too large.

    Looks like a bug.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter Gal Baras

    (@galbaras)

    Using this filter makes sense and works OK for me (I guess I use/write good themes).

    Having said that, I’d make this a setting, rather than a filter and turn it off by default to avoid the additional script on most sites, because I think most sites will be OK.

    Interestingly, when I use “width:auto”, the browser stretches the image itself to the dimensions of the “width=” and “height=” attributes, which makes the width with padding and border “too big”. This means that the lazyload sizes script might be doing the right thing, and the problem is with the way the browser renders “auto” images.

    Looks like we’re done. Thank you for playing!

    Thread Starter Gal Baras

    (@galbaras)

    OK, one more. After some more testing, the responsive/script version is causing my browser (Chrome) to load the smaller sources, and without it, it seems to just be loading the largest image, so I’m back with the script.

    Plugin Author nosilver4u

    (@nosilver4u)

    Yeah, that seems to be very common for sizes attributes to load inefficient images in WordPress. The default Twenty Nineteen theme needs some major care in this area. It even sets the wrong content_width global, which required some custom tweaks for ExactDN. Always something needs fixing!

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Incorrect value for “sizes” in lazy load’ is closed to new replies.