Skip to content

Instantly share code, notes, and snippets.

@firebelly
Created November 8, 2011 17:42
Show Gist options
  • Save firebelly/1348496 to your computer and use it in GitHub Desktop.
Save firebelly/1348496 to your computer and use it in GitHub Desktop.
save the damn thumbs
# load an image from an external URL, create a crop, and save it to disk
# *run from rails console of an app with Dragonfly already initialized at startup
app = Dragonfly[:images]
image = app.fetch_url('http://farm6.static.flickr.com/5277/5890615224_2fb702c22c_b.jpg')
image.process('412x252#').to_file("#{Rails.root}/public/system/images/#{url.split('/').last}")
`open /Users/brandon/webapps/fchapp/public/system/images/5890615224_2fb702c22c_b.jpg`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment