Forked from markevans/dragonfly

An on-the-fly processing/encoding framework written as a Rack application.

License: MIT

Language: Ruby


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 (Rails 2.3 only):

config.gem 'rmagick',    :lib => 'RMagick'
config.gem 'rack-cache', :lib => 'rack/cache'
config.gem 'dragonfly'

Gemfile (Rails 3 only):

gem 'rmagick',    :require => 'RMagick'
gem 'rack-cache', :require => 'rack/cache'
gem 'dragonfly'

The above assumes that you have as one of your gem sources. If not you should add it, e.g. gem source --add from the command line, or add source to your Gemfile.

Initializer (e.g. config/initializers/dragonfly.rb):

require 'dragonfly/rails/images'


add_column :albums, :cover_image_uid, :string


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

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) %>

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


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


Google group dragonfly-users



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

Project Statistics

Sourcerank 3
Repository Size 1.93 MB
Stars 3
Forks 3
Watchers 1
Open issues disabled
Dependencies 21
Tags 30
Last updated
Last pushed

Recent Tags See all

v0.6.1 May 16, 2010
v0.6.0 May 11, 2010
v0.5.7 April 18, 2010
v0.5.6 April 13, 2010
v0.5.5 April 13, 2010
v0.5.4 April 12, 2010
v0.5.3 March 27, 2010
v0.5.2 March 04, 2010
v0.5.1 February 20, 2010
v0.5.0 February 20, 2010
v0.4.4 February 16, 2010
v0.4.3 January 24, 2010
v0.4.2 January 10, 2010
v0.4.1 January 07, 2010
v0.4.0 January 04, 2010

Something wrong with this page? Make a suggestion

Last synced: 2017-07-14 06:59:50 UTC

Login to resync this repository