{"id":190,"date":"2012-04-26T14:42:28","date_gmt":"2012-04-26T14:42:28","guid":{"rendered":"http:\/\/www.w3.org\/community\/respimg\/?p=190"},"modified":"2012-05-11T19:08:02","modified_gmt":"2012-05-11T19:08:02","slug":"syntax-issue-with-displaying-high-resolution-images-in-the-picture-element-how-a-mole-hill-could-turn-into-a-mountain","status":"publish","type":"post","link":"https:\/\/www.w3.org\/community\/respimg\/2012\/04\/26\/syntax-issue-with-displaying-high-resolution-images-in-the-picture-element-how-a-mole-hill-could-turn-into-a-mountain\/","title":{"rendered":"Syntax issue with displaying high-resolution images in the picture element"},"content":{"rendered":"<p><strong>EDIT: We can all agree that the picture element can become <a href=\"https:\/\/gist.github.com\/2509534\" target=\"_blank\" rel=\"nofollow\">very verbose<\/a>. Especially if you are thinking about supporting a wide range of devices with multiple screen sizes\/resoltions.<\/strong><\/p>\n<p><strong> <\/strong>I&#8217;ve put together an example of some markup that would help allievate this issue based on image-set() CSS and URI Temapltes.<\/p>\n<p><strong>View Example Mark-Up &#8211;\u00a0<a href=\"https:\/\/gist.github.com\/2572749\" target=\"_blank\" rel=\"nofollow\">https:\/\/gist.github.com\/2572749<\/a><\/strong><\/p>\n<p><strong><\/strong>Big thanks to Adam Bradley for his feedback on this and helping me understand why this makes so much sense as an\u00a0alternative\u00a0way to author picture elements which makes them easier to maintain and keeps our markup DRY.<\/p>\n<p><strong><\/strong>Also, Philip Ingrey reminded me that these can all be in one media query and that each vendor prefixed device pixel ratio doesn&#8217;t need to be in an individual media query. I must have had a mind blank when I originally wrote this. I&#8217;ve updated the markup to show his example which I think is a perfect solution to the &#8220;issue&#8221; I was describing. I&#8217;ve also moved some of the code examples to github.<\/p>\n<pre> &lt;picture alt=\"Alt tag describing the image\u00a0represented\"&gt;\r\n     &lt;source src=\"photo.jpg\"\/&gt;\r\n     &lt;source src=\"photo@2x.jpg\" media=\"-webkit-min-device-pixel-ratio:2,-moz-min-device-pixel-ratio:2,-o-min-device-pixel-ratio: 2\/1,min-device-pixel-ratio:2\"\/&gt;\r\n     &lt;img src=\"photo.jpg\" \/&gt;\r\n &lt;\/picture&gt;<\/pre>\n<p>As\u00a0<a href=\"http:\/\/www.zdnet.com\/blog\/computers\/intel-says-to-expect-retina-display-quality-laptops-all-in-one-desktops-in-2013\/7892\" target=\"_blank\" rel=\"nofollow\">more<\/a>\u00a0and\u00a0<a href=\"http:\/\/www.macrumors.com\/2011\/02\/24\/mac-os-x-lion-building-in-support-for-super-high-resolution-retina-monitors\/\" target=\"_blank\" rel=\"nofollow\">more<\/a>\u00a0high-resolution devices come out, from smart phones, to\u00a0<a href=\"http:\/\/www.theverge.com\/2012\/3\/22\/2893064\/windows-8-screen-size-resolution-support\" target=\"_blank\" rel=\"nofollow\">tablets<\/a>, to\u00a0<a href=\"http:\/\/www.theverge.com\/2012\/4\/12\/2943792\/intel-retina-style-display-laptop-2013\" target=\"_blank\" rel=\"nofollow\">laptops and desktops<\/a>, I think we will start to need 2 images for each breakpoint. \u00a0Where originally the picture element might have been used like so:\u00a0<a href=\"https:\/\/gist.github.com\/2509519\" target=\"_blank\" rel=\"nofollow\">https:\/\/gist.github.com\/2509519<\/a><\/p>\n<p>I feel like a more realistic example of the picture element being used in the future will be:\u00a0<a href=\"https:\/\/gist.github.com\/2509534\" target=\"_blank\" rel=\"nofollow\">https:\/\/gist.github.com\/2509534<\/a><\/p>\n<p>I&#8217;m glad Philip reminded me of my mistake, because the markup I had imagined to handle all the vendor prefixes to do this was crazy.<\/p>\n<p>On a side note, I&#8217;d love to see the user be able to choose if they want high-resolution graphics in their browser, just like they can choose their default font-size. Maybe an option where you can pick SD graphics and HD graphics. If they choose SD, it would say their device had a pixel ratio of 1 rather than 2 even if they were on a retina device.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>EDIT: We can all agree that the picture element can become very verbose. Especially if you are thinking about supporting a wide range of devices with multiple screen sizes\/resoltions. I&#8217;ve put together an example of some markup that would help &hellip; <a href=\"https:\/\/www.w3.org\/community\/respimg\/2012\/04\/26\/syntax-issue-with-displaying-high-resolution-images-in-the-picture-element-how-a-mole-hill-could-turn-into-a-mountain\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1382,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","footnotes":""},"categories":[1],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/users\/1382"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":5,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":192,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/190\/revisions\/192"}],"wp:attachment":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}