Live data from Hacker News

First draft of HTML img srcset for responsive images

whatwg.org

11–20 of 79 posts

Re: First draft of HTML img srcset for responsive images

#11
post #7

Earlier quoted context omitted.

Because it is way more verbose and does not address the pixel density case.

But pixel density is a property of the media, which should be dealt with by media queries.

Querying the pixel density of the device is not the same as describing the pixel density of the resource. This has been a common misconception in the discussion of this feature.

Re: First draft of HTML img srcset for responsive images

#13
post #10
post #3

I think lots of informal URLs consist U+002C COMMA character (,) Why not ? Is this against SGML syntax?

Why not like the video-tag ... Or something like that.

See necolas comment above - ie the propose picture element.

Re: First draft of HTML img srcset for responsive images

#14
post #11

Earlier quoted context omitted.

But pixel density is a property of the media, which should be dealt with by media queries.

Querying the pixel density of the device is not the same as describing the pixel density of the resource. This has been a common misconception in the discussion of this feature.

Apologies - I misunderstood the proposal. However, what is the pixel density of a PNG?

Re: First draft of HTML img srcset for responsive images

#16
Better than this specification hassle is this solution:

The browser should send the density of the screen in ppi (calculated by the screen resolution and the screen information provided by the OS) together with all the other standard stuff like OS, screen resolution, etc.

With this information the server can decide which images to send.

Re: First draft of HTML img srcset for responsive images

#17
post #11

Earlier quoted context omitted.

Querying the pixel density of the device is not the same as describing the pixel density of the resource. This has been a common misconception in the discussion of this feature.

Apologies - I misunderstood the proposal. However, what is the pixel density of a PNG?

PPI can be stored in the "pHYs" chunk in a PNG. And some image processing/editing tools do so, such as Photoshop starting with version 7.

http://www.libpng.org/pub/png/book/chapter11.html#png.ch11.d...

http://www.scantips.com/basics9p.html

Re: First draft of HTML img srcset for responsive images

#18

I like the concept, but the syntax feels awkward, clunky and very specific. Why not repurpose the media attribute from style tags to all other tags?

> the syntax feels awkward, clunky and very specific

Yeah, stuff like "2x 100w" looks a bit like magic numbers[1]

Also there's potential for confusion in 'x' - does it mean X as in a co-ordinate i.e. width, or zoom? I'd rather see something more verbose like this:

    
      
      
    
Yes it's more wordy to write, but you read code more than you write it so it makes sense to optimise for readability over byte-shaving.

[1] http://catb.org/jargon/html/M/magic-number.html

Re: First draft of HTML img srcset for responsive images

#19
post #16

Better than this specification hassle is this solution: The browser should send the density of the screen in ppi (calculated by the screen resolution and the screen information provided by the OS) together with all the other standard stuff like OS, screen resolution, etc. With this information the server can decide which images to send.

No, this won't work in the wild.

It breaks caching completely.

It requires scripting just to serve an image.

The same url can have different data - imagine if you resume downloading a file, only to suddenly have a different file.

Re: First draft of HTML img srcset for responsive images

#20
post #8

Previous discussion about this by developers (170+ comments) who have been discussing Responsive Images in a W3C Community Group - http://www.w3.org/community/respimg/2012/05/11/respimg-propo...

The only problem with the element is how to address backwards compatibility? The srcset attribute is backwards compatible because old browsers will just ignore srcset and use the src, but old browsers will ignore the element completely -- how do you get something that works for older browsers but also works for new browsers as well?
Post reply on HN