Carrierwave or Dragonfly

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu

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

Heading into 2013, should I go with Dragonfly or Paperclip or Carrierwave?

Carrierwave has good support for exterior things such as DataMapper, Mongoid, Sequel and even can be used with a 3rd party image managment such as cloudinary
The solution seems most complete with support coverage for about anything, but the solution is also much messier (for me at least) since there is a lot more code that you need to handle. It is actively maintained with a plethora of add-ons created by its rich community for support for many features. It also features migration instructions from other attachment solutions such as paperclip. It has about 3-4 active contributors/maintainers

Paperclip is from thoughtbot so it should be a well planned, fully featured, easy-to-handle solution for attaching files. It utilizes many built-in functions that make the experience less straining in a Rail environment. Paperclip is better for an organic Rails environment using activerecord and not all the other alternatives. Paperclip is much easier to handle for beginning rails developers and it also has advanced capabilities for the advanced developer. It has about 2-3 active maintainers. Looking at the github graphs, it seems that last few months haven't been very prolific for paperclip, with relatively few commits to the code. Hope this changes and it can be up to par with carrierwave (usually more maintainers mean more code)

Dragonfly is a rack based attachment solution. It has much support for other frameworks other than Rails, it has several addons for exterior service support but as seen from its github page, a lot is still missing. This is probably due to it having 1 active maintainer and no commit since April 2012. If it doesn't get some real boost, I don't see it living for so much longer. Especially with Rail 4 coming out soon.

At the end of line, each solution has its pros and cons, and each solution works best for each developer.

See the following list with what people has to say about each and decide whether the problems they present concern you:

Rails 3 paperclip vs carrierwave vs dragonfly vs attachment_fu

https://stackoverflow.com/questions/1614842/what-is-the-best-file-upload-attachment-plugin-rails?rq=1

Attachment_fu or Paperclip for Rails3

Carrierwave or Dragonfly

To answer your question - both carrierwave and paperclip can do uploading and resizing of images.

As for you question in the comment, I use paperclip but since carrierwave has a capability to migrate to it from paperclip I might switch if it no longer suits my needs. At the moment it does.

The best way to choose is to pick one, try it, and decide for yourself.

Multi file upload with rails_admin (Carrierwave, Paperclip, Dragonfly)

The approach I'd take here is to develop a custom action which would include it's own view and controller processing.

You can generate a rails_admin plugin with the directions at the top of the page here.

And here are some examples of custom actions I've built out:

  • Import
  • Print to PDF

The import plugin has a supporting blog article here. This is the file you want to look at where you add your upload behavior inside the :controller instance option.

Dragonfly images in a polymorphic association syntax?

You are trying to call an attribute from a list of pictures.

You will need to go through each or call the first picture:

<% teacher.pictures.each do |pic| %>
<%= image_tag pic.image %>
<% end %>

or...

image_tag( teacher.pictures.first.image ) if teacher.pictures.any?

Hope this helps

EDIT (In response to your comment below)

In your Teacher model you could define a method that returns the first picture:

def first_picture_image
self.pictures.first.try(:image)
end

If the teacher has no pictures associated to it, the above method will return nil.



Related Topics



Leave a reply



Submit