Skip to content

Instantly share code, notes, and snippets.

@alanfluff
Created February 27, 2013 11:57
Show Gist options
  • Save alanfluff/5047413 to your computer and use it in GitHub Desktop.
Save alanfluff/5047413 to your computer and use it in GitHub Desktop.
Picturefill markup with ProcessWire image sizing
/*
From Marty Walker Pastie
Picturefill markup with ProcessWire image sizing
https://github.com/scottjehl/picturefill/
http://processwire.com/
*/
<div data-picture data-alt='{$page->title}'>
<div data-src='{$image->size(50,0)->url}'></div>
<div data-src='{$image->size(375,0)->url}' data-media='(min-width: 400px)'></div>
<div data-src='{$image->size(480,0)->url}' data-media='(min-width: 800px)'></div>
<div data-src='{$image->size(688,0)->url}' data-media='(min-width: 1000px)'></div>
<!-- Fallback content for non-JS browsers. Same img src as the initial, unqualified source element. -->
<noscript><img src='{$image->size(375,0)->url}' alt='{$page->title}'></noscript>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment