Srcset Using Full Image Size
-
Hello! I’m having an issue with responsive images that I’m hoping that I get some help with.
I have a client site that I built using Bones theme as a base. Right before my colleagues and I launched the site, we noticed that all of the images in the body copy, that had been inserted to the editor using the “Add Media” button, were loading into the browser at their full size. In many instances, this meant that JPGs 3264×2178 or larger will be transmitted. This is not good, obviously.
Here’s a sample
tag that is being outputted:
<img class="aligncenter size-full wp-image-2917" src="http://localhost/site/wordpress/../uploads/2016/10/IMG_7968.jpg" alt="img_7968" width="3264" height="2448" srcset="http://localhost/site/wordpress/../uploads/2016/10/IMG_7968.jpg 3264w, http://localhost/site/wordpress/../uploads/2016/10/IMG_7968-300x225.jpg 300w, http://localhost/site/wordpress/../uploads/2016/10/IMG_7968-768x576.jpg 768w" sizes="(max-width: 3264px) 100vw, 3264px">The column for our site design is 1024 pixels. I added additional sizes via add_images_sizes, and this particular image, does in fact have a 1280×960 version in the Uploads folder.
What I don’t understand:
– Why is WordPress inserting the image’s full width for the max-width property?
– Why is the 1280×960 version seemingly being ignored?I’ve tried all sort of things. I made sure to update to the latest version of WP. I’ve disabled all plugins, and reverted from my custom theme to Twenty Fifteen (which is what was in the WP installation we based it on.) The problem persisted when I was using the plugin-less Twenty Fifteen theme.
I tried third-party solutions, such as image size re-processors, to ensure that the custom sizes I’d added were being used. I tried existing media library images; I added brand new ones. I tried the
max_srcset_image_widthhook. No luck.I did try a fresh install of WP 4.6.1, with both the Twenty Sixteen and the original Bones theme, and they did *not* exhibit the problem. So I’m at a loss, currently.
Has anyone out there had to contend with this problem before? Any advice would be greatly appreciated.
The topic ‘Srcset Using Full Image Size’ is closed to new replies.