Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

dragonfly

> 编程语言
Open source

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

32.0K stars0 likes4 views
WebsiteGitHub

About

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

Dragonfly

Hello!! Dragonfly is a highly customizable ruby gem for handling images and other attachments and is already in use on thousands of websites.

If you want to generate image thumbnails in Rails ...

ruby
class User < ActiveRecord::Base  # model
  dragonfly_accessor :photo
end
erb
<%= image_tag @user.photo.thumb('300x200#').url if @user.photo_stored? # view %>

... or generate text images on-demand in Sinatra ...

ruby
get "/:text" do |text|
  Dragonfly.app.generate(:text, text, "font-size" => 32).to_response(env)
end

... or just generally manage attachments in your web app ...

ruby
wav = Dragonfly.app.fetch_url("http://free.music/lard.wav")  # GET from t'interwebs
mp3 = wav.to_mp3  # to_mp3 is a custom processor
uid = mp3.store   # store in the configured datastore, e.g. S3

url = Dragonfly.app.remote_url_for(uid)  # ===> http://s3.amazon.com/my-stuff/lard.mp3

... then Dragonfly is for you! See the documentation to get started!

Documentation

THE MAIN DOCUMENTATION IS HERE!!!

RDoc documentation is here

Installation

gem install dragonfly

or in your Gemfile

ruby
gem 'dragonfly', '~> 1.4.2'

Require with

ruby
require 'dragonfly'

Articles

See the Articles wiki for articles and tutorials.

Please feel free to contribute!!

Examples

See the Wiki and see the pages list for examples.

Please feel free to contribute!!

Plugins / add-ons

See the Add-ons wiki.

Please feel free to contribute!!

Security notice!

If you have set verify_urls to false (which is not recommended) then you should upgrade to version 1.4.x for a security fix (CVE-2021-33564).

Issues

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

Known Issues

There are known issues when using with json gem version 1.5.2 which can potentially cause an "incorrect sha" error for files with non-ascii characters in the name. Please see https://github.com/markevans/dragonfly/issues/387 for more information.

Suggestions/Questions

Google group dragonfly-users

Ruby Versions

See Travis-CI for tested versions.

Upgrading from v0.9 to v1.0

Dragonfly has changed somewhat since version 0.9. See the Upgrading wiki for notes on changes, and feel free to add anything you come across while upgrading!

Changes are listed in History.md

If for whatever reason you can't upgrade, then the docs for version 0.9.x are here.

Credits

Mark Evans (author) with awesome contributions from these guys

Issues· 71 open

View all issuesOpen on GitHub
  • #530

    Security Disclosure

    Updated Jun 23, 2026
  • #528

    [breaking] ostruct dependency introduced in 1.4.1 breaks dragonfly as it has stricter handling of internals than Ruby stdlib version

    Updated Jul 21, 2025
  • #526

    Large temp file creation when a video is analysed

    Updated Jan 19, 2025
  • #522

    Allowing quality and interlace params for imagemagick thumb processor

    Updated Jul 15, 2022
  • #519

    CSS style color raising InvalidParameter when using plain generator

    Updated Jul 7, 2022
  • #518

    validate problems?

    Updated Aug 28, 2021
  • #505

    warning: loading in progress, circular require considered harmful

    Updated Feb 27, 2021
  • #476

    how to upload file via url

    Updated Sep 8, 2020
  • #510

    Support for posix-spawn?

    Updated Jul 29, 2020
  • #509

    is this version of Dragonfly compatible ?

    Updated Jul 23, 2020

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedDec 5, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言