Rack::Snapshot
Added by reagent
at November 15, 2009 20:20
GitHub stats:
watcher(s)
fork(s)
About
Rack::Snapshot is a quick way to expand image urls for the popular image sharing services. If you have a URL to a public page for an image on Skitch, Img.ly, Twitpic, Yfrog, Flickr, or Twitgoo, this middleware will embed the direct image URL for you.
Usage
If you're using this in a Rails project, simply configure your environment:
config.gem 'snip-snap', :lib => 'snip_snap', :source => 'http://gemcutter.org'
config.gem 'hpricot'
config.middleware.use "Rack::Snapshot"
If you're using it in a Rack environment, you'll need to make sure that the snip-snap and hpricot gems are installed and then configure the middleware:
use Rack::Snapshot
By default, this will rewrite image tags that contain the class "expand", but you can configure this:
config.middleware.use "Rack::Snapshot", :class_name => 'sekrit'
Expansion of Flickr URLs is supported if you supply your Flickr API key:
config.middleware.use "Rack::Snapshot", :flickr_api_key => 'abc123'
More information is available in the included Gist.
