Giter Club home page Giter Club logo

dragonfly's Introduction

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 (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 http://gemcutter.org as one of your gem sources. If not you should add it, e.g. gem source --add http://gemcutter.org from the command line, or add source http://gemcutter.org to your Gemfile.

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

require 'dragonfly/rails/images'

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-2010 Mark Evans. See LICENSE for details.

dragonfly's People

Contributors

olly avatar zach avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.