Which should you use – CarrierWave, Paperclip or Dragonfly?

Cloud-based storage has become incredibly cheap. Rails plugins like fog give you stupid simple cloud service integration. It’s no wonder there are some great libraries for integrating image manipulation with cloud uploading.

Motivation

This winter break, I’m hacking on a mongodb-backed refresh of GifURl, my handy-dandy database of user-uploaded gifs. One of the important features of GifURL is its ability to take a user’s submitted gif URL (or entire page of scrape-able gifs) and ensure it is safely hosted for the future.

In my previous iteration, I wrote a couple of functions to host images on imgur and fail back to ehost which can support much larger gif file sizes (looking at you, animated gifs made from YouTube videos).

This time, in addition to these fail-backs, GifURL will store backups of the submitted images on a remote server. In order to do this, we need two things – a remote storage solution and

CarrierWave vs. Paperclip vs. Dragonfly comparison

This is a bit of a meta-review of comparisons of CarrierWave, Paperclip and Dragonfly.

CarrierWave

2,494 watchers, 569 closed issues

From what I’ve read, CarrierWave is the most mature and full-featured image processing and uploading library out there for Rails 3. There is support for a number of object-relational mappers, including carrierwave-mongoid

There is a nice RailsCast on CarrierWave, which will give you a good idea of what’s involved with implementing an upload view, form, controller and Uploader class and generating thumbnails for users' uploads with an RMagick transform.

It’s also worth noting that CarrierWave has a Paperclip compatibility layer that lets you migrate your Paperclip-integrated app relatively painlessly. CarrierWave can now be used with mongo_mapper, though much of the mongo_mapper crowd has run off to use Dragonfly due to Carrierwave’s late support.

There’s also a nice demo implementation of using CarrierWave for avatar uploads targeting a Heroku deployment using s3 for storage (directly, without using fog).

Paperclip

3,836 watchers, 639 closed issues

Paperclip is a file upload handling library built by the fine gents from Boston’s ThoughtBot (of Shoulda, FactoryGirl, and apprentice.io fame).

Paperclip has long been the way to implement cloud-backed file uploads in Rails. It has some seriously convenient methods and ThoughtBot’s code tends to be easy to read.

You can find tutorials on doing a lot of things with Paperclip, such as using Delayed Job to queue up Amazon S3 uploads and animated gif resizing seems to be simpler now.

Dragonfly

746 watchers, 149 closed issues

Dragonfly is a relative newcomer, but there are some early signs it will be the way to go soon enough. Many mongo_mapper users have moved to it as Dragonfly supports mongomapper by default.

There are special instructions for using Dragonfly on Heroku

See also

About the Author

I'm a game and web developer in San Francisco working on Coding for Interviews among other independent projects. Formerly @ PopCap, intern @ TripAdvisor, One Laptop per Child, Tufts CS. Follow me on Twitter @bcjordan or Google+.



blog comments powered by Disqus