TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Goodbye to Painful Image Loads on Small Devices

109 pointsby seferphieralmost 12 years ago

13 comments

russellurestialmost 12 years ago
It's not a bad solution, but I don't think it's the best solution. Obviously, the thing that sticks out as being the most inefficient is that the small (or default) image is always loaded. This means that for tablets and desktop browsers there will be an extra image request that is never used. Not too bad, but on a page with a lot of images this could add up.<p>I haven't personally tried it yet, but it seems the best option out there at the moment is the Capturing polyfill by Mozilla (<a href="https://hacks.mozilla.org/2013/03/capturing-improving-performance-of-the-adaptive-web/" rel="nofollow">https://hacks.mozilla.org/2013/03/capturing-improving-perfor...</a>).<p>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 : <a href="https://github.com/adamdbradley/foresight.js" rel="nofollow">https://github.com/adamdbradley/foresight.js</a>). 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.
评论 #5799070 未加载
gondoalmost 12 years ago
this solution does not work as domload is executed way too late and image replacement cause nasty reflow.<p>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<p>i wrote a blog post about this some time ago <a href="http://gondo.webdesigners.sk/responsive-images/" rel="nofollow">http://gondo.webdesigners.sk/responsive-images/</a> 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.
bsimpsonalmost 12 years ago
Their demo page fails to take into account pixel density, which is a shame since serving the right image to the right device is their entire justification.<p>Those images look awful on my Chromebook Pixel.
aaronbrethorstalmost 12 years ago
This looks great! How do I specify a media query for different screen densities? For instance, if I wanted to serve a 2880px wide image to a 15" Retina MacBook Pro and a 1440px to a 'normal' computer?
评论 #5799259 未加载
评论 #5799307 未加载
r0salmost 12 years ago
How does this compare with existing solutions like: <a href="http://adaptive-images.com/" rel="nofollow">http://adaptive-images.com/</a> ?<p>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.
评论 #5800241 未加载
disbeliefalmost 12 years ago
Could someone explain to me why this is better/easier than just using CSS media queries myself?<p>Also:<p>&#62; 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.<p>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"?
评论 #5798988 未加载
评论 #5799076 未加载
评论 #5798549 未加载
merittalmost 12 years ago
How about only loading the best image once? Forcing the smallest image down the throat of everyone is wasteful and only benefits mobile.
da_nalmost 12 years ago
I'm a huge fan of Zurb and their work on Foundation, this looks like a good stopgap implementation. I just hope it isn't long until there is a standard implementation everyone can settle on, we don't want to end-up with <a href="http://xkcd.com/927/" rel="nofollow">http://xkcd.com/927/</a>
评论 #5799793 未加载
bchhunalmost 12 years ago
I wouldn't mind having Interchange or this: <a href="http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/#adaptive-images" rel="nofollow">http://www.w3.org/html/wg/drafts/srcset/w3c-srcset/#adaptive...</a> as a standard
评论 #5799088 未加载
newman314almost 12 years ago
Does anyone know of a JS slideshow that leverages this? I would love to have the ability to load smaller images for a mobile device.
评论 #5800322 未加载
crazysimalmost 12 years ago
Is there an RSS feed of Zurb's blog? I can't seem to find it.
评论 #5798834 未加载
评论 #5798813 未加载
_kalmost 12 years ago
What if users want to zoom in on the picture ?
mtrimpealmost 12 years ago
I also ran across imgix.com a few days ago which is a CDN that does on the fly image resizing on GPUs.<p>Are there some examples on how you would integrate something like that here?
评论 #5798573 未加载
评论 #5798699 未加载