7 ms·
Is there a way this can take place entirely server side?
by woodall 14y ago
Is 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.)
- michaelmior 14y agoYou can, but this is server dependent and not possible with the GIF format. If you were to construct a format where this is possible, this would mean a minimum of two HTTP requests and quite possible three since the header would have to be of variable length. Additionally, trying to get browsers to consistently implement something of this level of complexity sounds dangerous.