Responsify WP
Responsify WP is the WordPress plugin that cares about responsive images. Features Use img with srcset/sizes attributes. …or the picture element. Works with or without Picturefill . Supports high resolution images (retina). Custom media queries. Handpick which image sizes to use. Responsive backgrou
Responsify WP is the WordPress plugin that cares about responsive images.
Features
- Use img with srcset/sizes attributes.
- …or the picture element.
- Works with or without Picturefill .
- Supports high resolution images (retina).
- Custom media queries.
- Handpick which image sizes to use.
- Responsive background images.
Demo
Responsify WP finds featured images and all images inside the content and makes them responsive. For example, you might have a template that looks like this:
<article> <h1><?php the_title();?></h1> <?php the_content();?> </article>
That will output something like this:
<article> <h1>Hello world</h1> <p>Lorem ipsum dolor sit amet...</p> <img src="large.jpg" alt="Image description"> </article>
But once you have activated the plugin, it will look like this instead:
<article> <h1>Hello world</h1> <p>Lorem ipsum dolor sit amet...</p> <img sizes="(min-width: 300px) 1024px, (min-width: 150x) 300px, 150px" srcset="thumbnail.jpg 150w, medium.jpg 300w, large.jpg 1024w" alt="Image description"> </article>
You can also choose to use the picture element instead:
<article> <h1>Hello world</h1> <p>Lorem ipsum dolor sit amet...</p> <picture> <source srcset="full-size.jpg" media="(min-width: 1024px)"> <source srcset="large.jpg" media="(min-width: 300px)"> <source srcset="medium.jpg" media="(min-width: 150px)"> <img srcset="thumbnail.jpg" alt="Image description"> </picture> </article>
It also works with high resolution (retina) images:
<article> <h1>Hello world</h1> <p>Lorem ipsum dolor sit amet...</p> <picture> <source srcset="full-size.jpg" media="(min-width: 1024px)"> <source srcset="large.jpg, large_retina.jpg 2x" media="(min-width: 300px)"> <source srcset="medium.jpg, medium_retina.jpg 2x" media="(min-width: 150px)"> <img srcset="thumbnail.jpg, thumbnail_retina.jpg 2x" alt="Image description"> </picture> </article>
The different versions of the image in the examples above is in the standard thumbnail , medium , large and full sizes. The media queries are based on the width of the “previous” image. Any custom sizes of the image will also be found and used.