4 ms·
Or, here's just a crazy out there thought. What if we save our images in high res progressive format, and program the browsers to stop downloading the images as
by ZenPsycho 14y ago
Or, here's just a crazy out there thought. What if we save our images in high res progressive format, and program the browsers to stop downloading the images as soon as they've acquired enough resolution? Caching can be done with http range requests. Older user agents just end up downloading larger images than they wanted. Javascript and server script can use the JPEGtran library to retrieve lossless low res versions of jpeg images. Similar things could be done with png. No modifications to any standards need to take place.
- woodall 14y agoIs there a way this can take place entirely server side?
- ZenPsycho 14y agosure, it would be simple enough to copy what was done with the server side image maps thing, and define some query parameters that get requested along with the image. So each different size gets its own url and proxies and caches are happy. servers that don't support it just serve a normal image. a tiny bit of javascript can polyfill it in now. today.
- hoppipolla 14y agoThat is a very appealing design, but sadly it doesn't address all the use cases. In particular one thing that people want to be able to do is to display a different image depending on the viewport dimensions, for example a closer crop on a small screen compared to that shown on a larger screen.
- ZenPsycho 14y agowhat is stopping this approach from addressing that use case?
- michaelmior 14y agoNo file format exists which supports this use case.
- ZenPsycho 14y agoJpeg does.
- michaelmior 14y agoI wasn't aware that you could specify completely different images at different resolutions.
- ZenPsycho 14y agoWe switched slightly midstream and we are now talking about an "entirely server side solution", if you scan back a few posts up. It's fairly trivial to do image processing on a server and cache the results based on the URL
- adavies42 14y agoi wonder if you could do it with separate frames of a GIF? there's no reason they have to be played as an animation. (they don't even have to be the same size as each other or the logical screen, afaict.)
- michaelmior 14y agoI don't see how the client could selectively download frames. GIF isn't really the nicest file format anyway.
- adavies42 14y agocan you fetch arbitrary byte ranges over http? i don't know the details of the GIF chunk format, but often there's a header or something that you could use to calculate what other part of the file you want. (yes, this is almost certainly a terrible way to implement it, but i was curious as to whether it could be shoehorned in.)
- WiseWeasel 14y agoThat's not backwards-compatible.