[webkit-dev] Content-DPR header
simon.fraser at apple.com
Fri May 29 15:32:24 PDT 2015
> On May 29, 2015, at 2:11 PM, Yoav Weiss <yoav at yoav.ws> wrote:
> On Fri, May 29, 2015 at 8:34 PM, Sam Weinig <weinig at apple.com <mailto:weinig at apple.com>> wrote:
> Hi Yoav,
> Can you give a concrete example of when this will be used? I’m having trouble understanding when an author will want to change an images intrinsic size but not have control of the markup.
> It's not about control over markup, it's about control over style.
> Let's say you're now given the following task: write a script that will go over all your server's HTML files and make your images responsive by adding a `srcset` attribute to all <img> tags. Since some of the images may change their display dimensions at different viewport sizes (i.e the "variable width" use case <https://dev.opera.com/articles/native-responsive-images/#variable-width-images>), you want to add multiple resources with `w` descriptors to each <img>. Each one of these resources will be pointed towards your shiny new image server, which has access to the original high-quality image as well as the currently displayed one (the "src image").
> But, since you don't know if all the images have their dimensions defined in CSS (and you suspect that a large chunk of them don't have CSS based dimensions), you want to make sure that the intrinsic dimensions of the displayed images remain the same even when you deliver images of varying "physical" dimensions. How can you achieve that?
> Well, the answer is, you want to modify the intrinsic size of the delivered images to be the same as the "src image"'s intrinsic dimensions. With Content-DPR, that's easy. You simply set it to the value that is the delivered image width divided by the "src image" width.
> That way, the browser takes the Content-DPR into account, scales the delivered image and it ends up with the same intrinsic dimensions as the "src image".
> If you don't have markup control, the same exercise applies, but would require the full-fledged Client-Hints in order to actually deliver resized images.
As others have said, doing this at the transport layer seems wrong.
Why not just invent some new metadata that gets put into the image to describe some scaling of the intrinsic size?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev