Goodbye to Painful Image Loads on Small Devices
zurb.com
zurb.com
I haven't personally tried it yet, but it seems the best option out there at the moment is the Capturing polyfill by Mozilla (https://hacks.mozilla.org/2013/03/capturing-improving-perfor...).
Another thing I would suggest the team think of is not loading images by browser width only. If we're tying these libraries to the idea that they improve performance by optimizing which images are loaded - so that you only transfer the necessary amount of KB per page view - browser width is a bit removed from what you want. What you actually want to measure is the user's network speed (which can be done with libraries like Foresight.js : https://github.com/adamdbradley/foresight.js). Loading large images on a slow network isn't going to be good for performance. By using both browser size and network speed, you can optimize images for mobile devices over 3G or those connected to WiFi. Or desktops on broadband versus desktops on 56k modems.
Please submit pull requests or issues for ways we can make this better, we're all ears.
RWD images problem is much more complicated than this. you have to consider things like: - dom reflow (img tag without width/heigh) - requests (additional request to load default image) - internet speed (you can use wifi on your phone, or 3g on laptop) - choosing breakpoints
i wrote a blog post about this some time ago http://gondo.webdesigners.sk/responsive-images/ apparently i'm not the first one thinking about using base tag. i've come across some old video (dont remember the link anymore) where it was refused because of "browser bug". unfortunately i never found out what bug is the guy referring to so i can just assume that it was already fixed.
Those images look awful on my Chromebook Pixel.
Right, which is what concerns me. So is this the expectation?
<img src="small.jpg" data-interchange="[normal.jpg, (only screen)], [medium.jpg, only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2),
only screen and (max-width: 749px)]">Obviously this is client side, does that make it better? Timing my page load around a set of loading images seems counter intuitive; there's lots of other stuff to worry about.
The server side technique could be achieved in any language really, so it doesn't require PHP unless we use that library.
Also:
> Whatever image you put inside the src of the image element will render by default. Then, the Javascript will progressively load larger images based on media queries that you pass into the data-interchange attribute.
So, for larger screens, there would be many requests for a single image? For example, if I drop a mobile-optimized image into the src and then view the page on a retina macbook, wouldn't this mean many image requests from the "mobile" version up through "full-size retina"?
For static hand coded images media queries will suffice but once you start dynamically serving images it gets tricky fast, especially when faced with users that don't know/care about HD images issues.
Combined with some code to scale images to the correct size on the fly (with caching, etc) I think it could be pretty useful.
The demo page doesn't seem to work that way. In fact, if you resize the window gradually, it won't load new images at all. You have to wait for a second after resizing for it to bother loading the new image.
From a practical standpoint, this is designed to address device-specific uses where the screen-width is less-likely to experience size-adjustments than a desktop browser, so you'll probably see the initial HTTP request for the small-resolution image, followed by the HTTP request for the appropriately-sized image for whatever device/screen you're using, and you're less-likely to see the same number of requests made while wildly resizing a demo page.
Markup for an image should not be several lines long.
Naturally, if/whenever it is implemented we'll all scuttle back to our keyboards and play with srcset .
edit: Ah, no meta tags.
Are there some examples on how you would integrate something like that here?
Or for bonus points, fork Interchange and have it pipe every image request through Imgix.
The tech behind the service sounds fantastic, I'd love to be able to use them.
Example:
640x400 and formatted as a jpg
https://www.filepicker.io/api/file/rHA62UiiQyCZdEyw6rgw/conv...
200x200 and a png
https://www.filepicker.io/api/file/rHA62UiiQyCZdEyw6rgw/conv...