Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu [closed]
Asked Answered
T

3

52

I'm working on upgrading a Rails 2.3.11, Ruby 1.9.2 app to Rails 3.0.10, and attachment_fu no longer works.

I'm looking at changing to paperclip, carrierwave, or dragonfly for file uploads, or maybe a Rails 3 compatible, maintained version of attachment_fu.

Which of these options would be the best to use in terms of performance, how well maintained it is, how easy it is to upgrade from attachment_fu, and maybe is it going to be Rails 3.1 compatible? What are the major strengths and disadvantages of each one?

Any insight would be appreciated.

Tergal answered 14/9, 2011 at 16:28 Comment(1)
ruby-toolbox.com/categories/rails_file_uploadsWinder
S
42

I've used both Paperclip and Carrierwave, and if I were you, I'd go for Carrierwave. It's a lot more flexible. I also love the fact that it doesnt clutter your models with configuration. You can define uploader classes instead. It allows you to easily reuse, extend etc your upload configuration.

Did you watch the Carrierwave railscast? http://railscasts.com/episodes/253-carrierwave-file-uploads

Paperclip is not a bad choice though, it's been the "best" choice for a long time. But Carrierwave definitely seems like the new generation ;)

Sagerman answered 14/9, 2011 at 16:37 Comment(3)
Thanks! I just watched the railscast, and the paperclip one as well. I think I'll be going with Carrierwave; it seems like that's what most people are saying to use. Now for the fun part upgrading from attachment_fu ...Tergal
There is a way to easily migrate from paperclip to carrierwave, but unfortunately, it's not the case for attachment_fu. From the carrierwave github page: "Unfortunately attachment_fu differs too much in philosophy for there to be a sensible compatibility mode. Patches for migrating from other solutions will be happily accepted." :(Sagerman
If you are trying to work with Rails 2.3.x and migrate from attachment_fu to CarrierWave first, I would suggest Paperclip over CarrierWave. When you are using the 0.4.x branch of CW with Rails 2.3.x, you can't set the content_type of a file on upload, which was a deal breaker for me. If you are migrating from attachment_fu and upgrading to rails 3, then you'll be fine, and CarrierWave is a great option.Chanel
F
40

I have used CarrierWave and after some hours of frustration I'm switching to Paperclip.

Here are the problems I have seen with CarrierWave:

  • You can't validate file size. There is a wiki article that explains how to do it, but it does not work.
  • Integrity validations do not work when using MiniMagick (very convenient if you are concerned about RAM usage). You can upload a corrupted image file and CarrierWave will throw an error at first, but the next time will swallow it.
  • You can't delete the original file. You can instead resize it, compress, etc. There is a wiki article explaining how to do it, but again it does not work.
  • It depends on external libraries such as RMagick or MiniMagick. Paperclip works directly with the convert command line (ImageMagick). So, if you have problems with Minimagick (I had), you will lose hours diving in Google searches. Both RMagick and Minimagick are abandoned at the time of this writing (I contacted the author of Minimagic, no response).
  • It needs some configuration files. This is seen as an advantage, but I don't like having single configuration files around my project just for one gem. Configuration in the model seems more natural to me. This is a matter of personal taste anyway.
  • If you find some bug and report it, the dev team is really absent and busy. They will tell you to fix bugs yourself. It seems like a personal project that is improved in spare time. For me it's not valid for a professional project with deadlines.
Furious answered 27/2, 2012 at 22:47 Comment(6)
yep, paperclip is making a comeback, and the fact that it works directly with ImageMagick is a big plusWarta
paperclip also has its drawbacks, so try it and if it works for you stay with it. It didn't work for me either, so I implemented my own lib for image uploads. But if I were to choose one, I'd go for paperclip for the (big) reasons explained above.Furious
are these drawbacks still relevant?Rosabelle
First Minimagick has been picked back up. Second while it is true that Paperclip works directly with imageMagick, it also makes it pretty hard to interact directly with it. I just moved from using Paperclip to CarrierWave because Paperclip does to much for you, and makes it hard to customize things when you need to. Not to mention the Paperclip code base is 'bloated' as they say, while the carrier wave is leaner, which is most likely a direct result of carrier wave leaving more things up to you, while paperclip tries to do more for you.Karyotin
The previous developer on our application had used CarrierWave to handle image uploads. We recently made the decision to change our schema to enable multiple images at once, and so we employed "embedded" documents in our Mongoid schema. Unfortunately, there is a three-year-old bug in CarrierWave that makes a mess of uploads to embedded documents. Paperclip for Mongoid, on the other hand, worked brilliantly.Maldonado
here is how to remove images in CarrierWave: profile.remove_logo! profile.save!Feodora
S
3

I would ask myself:

  • Will I be changing image size often? Example: if you want to let your users change the size of their pictures (or your need flexibility in size for some other reason), or really fast development.

Yes: Dragonfly

No: either Carrierwave or Paperclip

Stochastic answered 4/4, 2013 at 18:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.