Skip to content

Responsive Images

Just read an interesting post by Craig Russel from January that I've just picked up: Responsive Images and Context Aware Image Sizing, which has some follow-up some thoughts on Filament Group's article. I'm interested in this from a WordPress point-of-view, since that's what I do most of my work with.

A first step would be to use add_image_size to generate the different image sizes.
One problem is deciding what set breakpoints to use.

Then, rather than using Craig's getimage.php, a filter would be added to post_content, looking for WordPress images (maybe looking for .wp-post-image) and replacing them on the fly with the desired size.
If you wanted to do this just for featured images it would be very simple. You could write a tiny custom script to pick the right argument for the call to the_post_thumbnail().

I'm looking forward to experimenting with this on my next project to see how practical or fiddly it is.