Hacker News new | ask | show | jobs
by ZenPsycho 5141 days ago
sure, 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.
1 comments

That 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.
what is stopping this approach from addressing that use case?
No file format exists which supports this use case.
We 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
I wasn't aware that you could specify completely different images at different resolutions.
i 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.)
I don't see how the client could selectively download frames. GIF isn't really the nicest file format anyway.
can 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.)

Jpeg does.