Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 1.67 KB

photon-local-development.md

File metadata and controls

26 lines (22 loc) · 1.67 KB

Using Photon in local development

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.

  1. 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.
  2. You probably don't have Gmagick installed on your machine. You'll need to perform some operations as sudo to make this happen.
  3. sudo su - Inside your Vagrant instance, switch to the super user.
  4. apt-get install libgraphicsmagick1-dev php5-dev make - Install Graphicsmagick dev tools. You may need to apt-get update
  5. cd /root; wget https://pecl.php.net/get/gmagick-1.1.7RC2.tgz - Grab Gmagick for compiling.
  6. tar -xvf gmagick-1.1.7RC2.tgz; cd gmagick-1.1.7RC2 - Get ready for compiling!
  7. phpize - Get ready for compiling again!
  8. ./configure; make; make install - Compile for your system.
  9. echo "extension=gmagick.so" > /etc/php5/mods-available/gmagick.ini - Make the PHP module available.
  10. ln -s /etc/php5/mods-available/gmagick.ini /etc/php5/fpm/conf.d/20-gmagick.ini - Enable the module.
  11. service php5-fpm restart - Restart PHP-FPM to enable the module.
  12. Use Jetpack 3.4.2 or later to ensure my filter is applied.
  13. 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.