WordPress Development Asked by 21stcn on December 6, 2021
I have an extremely frustrating problem where mobile (tested chrome on android & ios, and safari on ios) is always using the largest sized image from the srcset (even if a smaller size is EXPLICITLY chosen in the editor).
Here is a summary of the problem:
So the problem is two-fold:
This is problematic because I purposefully generate many different image sizes as the original images for this blog are often quite large, often a couple of megabytes. So I have a post with 30 images, each with an elaborate srcset, and yet Chrome on Android is downloading the 1.5Mb version for every one (that’s 45Mbs on mobile, even though there are images sizes and a srcset — and a lightbox and lazy-loading which I’ve disabled for testing — for this exact reason).
The image below is a screenshot from Chrome inspector using remote USB debugging (so this is actually from a phone, not browser simulation). You can see the image’s actual SRC attribute is the correct, smaller version of the image (notice the ‘-720×480’):
http://media.londolozi.com/wp-content/uploads/2017/08/10130833/DSC_3855-720x480.jpg
However, Chrome on Android has in fact downloaded and is serving the full image. I know this because:
Some other things:
a
tag’s href
interfering) So I don’t know how to explain this behaviour.
Am I correct in asserting that if I explicitly set a size when inserting an image into a post, that the image downloaded by the browser should not be larger than that size, no matter what? Or else setting a size is redundant.
Any ideas why this is happening?
browsers take
pixel ratio
into account when choosing which image to download, you should check that your pixel ratio is 1 before trying to resize browser and understand the logic
Answered by fadomire on December 6, 2021
I messed up with my comment and can't edit it. So, I writing as an answer instead:
This is probably (99.99%) not a WordPress issue, rather a Chrome one, something related to it's CSS and/or image heuristics. Therefore:
Let me know if it helps you.
Answered by Celso Bessa on December 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP