I am a big fan of the Timber plugin for theme development and Jetpack’s Photon for image manipulation and as a CDN.

Timber enables you to create clean WordPress templates using the popular Twig template engine. Photon automatically caches all the images in your posts and serves them from the WordPress servers, taking the load off of your own server.

I decided to put the two together in a plugin so that all other images in your Twig templates are sent through Photon as well. You can even use the image filters that come with Timber (resize, letterbox).

Get Timber with Jetpack Photon from the WordPress plugin repository.

What does it do?

Timber with Jetpack Photon extends the current TimberImage class to use Photon to serve and manipulate your images.

  • {{post.thumbnail.src}} returns a Photon URL
  • {{post.thumbnail.src|resize(100)}} returns a Photon URL and resizes the image to 100 pixels wide.
  • {{post.thumbnail.src|resize(100,200)}} returns a Photon URL and resizes the image to 100 pixels wide and 200 pixels high.

A Photon URL looks like this:

http://i0.wp.com/www.slimndap.com/wp-content/uploads/2014/05/slimndap.png