Shutterbug

Build Status Code Climate

A rack utility that will create and save images (pngs) from parts of your html's documents current dom. These images become available as public png resources in the rack application. Currently shutterbug supports HTML, SVG and Canvas elements.

use Shutterbug::Rackapp

Installation

Add this line to your application's Gemfile:

gem 'shutterbug'

And then execute:

$ bundle

Or install it yourself as:

$ gem install shutterbug

License

See License.txt for more information.

Usage

After adding use Shutterbug::Rackapp to your config.ru file, you can convert pieces of your web-page into png images. Just follow these steps:

  1. include the following javascript in your pages: <script src='http://<yourhost:port>/shutterbug/shutterbug.js' type='text/javascript'></script>
  2. Elsewhere in your javascript call getDomSnapshot($("#sourceDomID"),$("#imageOutputDomId")); This will replace the contents of $("#imageOutputDomId") with an <img src="http://<yourhost:port>/gete_png/sha1hash> tag which will magically spring into existance.

TODO:

  • Configuration of the rack paths.
  • Fix web-font bugs in phantom js.
  • Better abstraction phantomjs command line invocation. Use phantomjs.rb ?
  • Use sprockets for and coffee.erb for shutterbug.js
  • Write Tests.
  • Write Documentation.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

© 2013 The concord Consortium.