Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Ruby Rack-based gem for on-the-fly processing - suitable for image uploading in Rails, Sinatra and much more!

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

Dragonfly

Dragonfly is a Rack framework for on-the-fly processing and encoding. It includes an extension for Ruby on Rails to enable easy image handling.

For the lazy rails user

To use simply for image thumbnails etc. in Rails...

environment.rb:

config.gem 'rmagick',    :lib => 'RMagick'
config.gem 'rack-cache', :lib => 'rack/cache'
config.gem 'dragonfly',  :lib => 'dragonfly/rails/images', :source => 'http://gemcutter.org'

Migration:

add_column :albums, :cover_image_uid, :string

Model:

class Album < ActiveRecord::Base
  image_accessor :cover_image            # Defines reader/writer for cover_image
  # ...
end

View (for uploading via a file field):

<% form_for @album, :html => {:multipart => true} do |f| %>
  ...
  <%= f.file_field :cover_image %>
  ...
<% end %>

View (to display):

<%= image_tag @album.cover_image.url(:gif) %>
<%= image_tag @album.cover_image.url('400x200') %>
<%= image_tag @album.cover_image.url('100x100!', :png) %>
<%= image_tag @album.cover_image.url('100x100#') %>
<%= image_tag @album.cover_image.url('50x50+30+30sw', :tiff) %>
<%= image_tag @album.cover_image.url(:rotate, 15) %>
...etc.

Using outside of rails, custom storage/processing/encoding/analysis, and more...

Dragonfly is primarily a Rack app, the Rails part of it being nothing more than a separate layer on top of the main code, which means you can use it as a standalone app, or with Sinatra, Merb, etc.

It is intended to be highly customizable, and is not limited to images, but any data type that could suit on-the-fly processing/encoding.

For more info, consult the DOCUMENTATION

Issues

Please use the github issue tracker if you have any issues.

Suggestions/Questions

Google group dragonfly-users

Credits

Copyright

Copyright (c) 2009 Mark Evans. See LICENSE for details.

Something went wrong with that request. Please try again.