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.
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.
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.
3,836 watchers, 639 closed issues
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.
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
- CarrierWave or Dragonfly on StackOverflow
- Paperclip vs. Carrierwave vs. Dragonfly vs. attachment_fu on StackOverflow
- Discussion in comments of 10 must have ruby gems on ThinkVitamin