Greg’s Plugins for WordPress

Plugins for WordPress

Portfolio of Plugins for Adoption!

Spritify

For themes which display a thumbnail image for each post listed in an archive, grab the thumbnails in advance, stitch them into a single sprite, and display the thumbnails as CSS background images.

What this Plugin Makes Possible

Displaying multiple thumbnail images in an archive or other listing of posts can significantly and negatively impact page loading time, since each image will get loaded as a separate resource request over a new connection. (SPDY and HTML 2.0 will ameliorate this issue somewhat, but for now, such multiple round trips between server and browser are a very big deal.)

This plugin will grab upcoming thumbnail images to be used in a listing of posts, stitch them together, and save the result in a cache as a single sprite. The plugin then adds relevant CSS rules to the head of the page and tweaks the post thumbnail HTML to refer to the CSS sprite rather than the original image. The plugin takes care of automatically clearing relevant sprite images from the cache whenever a post’s thumbnail is changed.

With theme integration, this plugin can also be used to “spritify” the thumbnail images shown by the popular Yet Another Related Posts Plugin, enabling individual posts to show related posts that are spruced up with just a single sprite image rather than multiple images.

Note that this plugin has not been tested extensively on other themes apart from my own, so aspects of the plugin may require additional attention before it is ready for wider use.

How it Works

This plugin communicates with WordPress primarily by tapping into the following:

  • post_thumbnail_html
  • wp_head
  • publish_post
  • publish_page

Configuration: None

No administrator time is required — just plug and play!