开发者

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu [closed]

开发者 https://www.devze.com 2023-04-05 09:09 出处:网络
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing th
Closed. This question is opinion-based. It is not currently accepting answers.

Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.

Closed 7 years ago.

Improve this question

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开发者_JAVA技巧 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.


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 ;)


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消