Automattic's Photon image resizing service is open source, so you can use it locally if you want to roll your sleeves up a bit.
- Check out the Photon codebase to a location served by your VIP Quickstart or Salty WordPress Vagrant:
svn co https://code.svn.wordpress.org/photon/ photon.dev
. You will probably need to edit/etc/hosts
on your local machine too. - You probably don't have Gmagick installed on your machine. You'll need to perform some operations as sudo to make this happen.
sudo su
- Inside your Vagrant instance, switch to the super user.apt-get install libgraphicsmagick1-dev php5-dev make
- Install Graphicsmagick dev tools. You may need toapt-get update
cd /root; wget https://pecl.php.net/get/gmagick-1.1.7RC2.tgz
- Grab Gmagick for compiling.tar -xvf gmagick-1.1.7RC2.tgz; cd gmagick-1.1.7RC2
- Get ready for compiling!phpize
- Get ready for compiling again!./configure; make; make install
- Compile for your system.echo "extension=gmagick.so" > /etc/php5/mods-available/gmagick.ini
- Make the PHP module available.ln -s /etc/php5/mods-available/gmagick.ini /etc/php5/fpm/conf.d/20-gmagick.ini
- Enable the module.service php5-fpm restart
- Restart PHP-FPM to enable the module.- Use Jetpack 3.4.2 or later to ensure my filter is applied.
- Add this code snippet to a local MU plugin:
define( 'FUSION_PHOTON_HOST', 'http://photon.dev' );
add_filter( 'jetpack_photon_domain', function( $domain ){
return FUSION_PHOTON_HOST;
});
And voila! Local images served from Photon.