katuma icon indicating copy to clipboard operation
katuma copied to clipboard

Add Upload powers to katuma

Open andresgutgon opened this issue 9 years ago • 30 comments

WAT

I think it's something nice to have be able to upload images in an application.

Some uses could be:

  1. Users upload avatar.
  2. Products with photo.
  3. Group home photo ala Facebook page.

Tech

I'm talking about use something like paperclip or carrierwave or another one that you consider is better for our needs.

Voluntaries?

@enricostano , @edulan @sauloperez ? :)

Motivation

A part from real utility of being able to upload image in the app, for me is the psychological factor. It's very sad being developing the front end without see avatars. Come on :)

andresgutgon avatar Dec 13 '15 20:12 andresgutgon

@andresgutgon I can take care of that as I already did for the photobooth.

From my experience, using gems like paperclip is the easiest way possible, at least for backend. We can also use workers for image processing. For frontend it requires a bit more work, as you'd have to adapt your XHR request to support multipart uploads.

We can talk about that offline if you want :+1:

edulan avatar Dec 14 '15 10:12 edulan

I'm in of course with this, just let's talk about planning the implementation bearing in mind future use cases that we already are aware of.

enricostano avatar Dec 14 '15 10:12 enricostano

For frontend it requires a bit more work, as you'd have to adapt your XHR request to support multipart uploads.

That's another story :) Let's add this feature to the backend and then we make the changes in the front end

andresgutgon avatar Dec 14 '15 10:12 andresgutgon

This is another option https://rubygems.org/gems/dragonfly

Let's try to pick the most lightweight solution, if possible of course.

enricostano avatar Dec 14 '15 10:12 enricostano

Here the winner is Paperclip https://www.ruby-toolbox.com/categories/rails_file_uploads

andresgutgon avatar Dec 14 '15 10:12 andresgutgon

That's not the right criteria IMO, please let's try to apply critical thinking.

enricostano avatar Dec 14 '15 10:12 enricostano

What's the right criteria?

  • Number of commiters
  • Last commit
  • Number of downloads
  • Number of bugs
  • ...

andresgutgon avatar Dec 14 '15 10:12 andresgutgon

Consider refile (new library from the ones behind Carrierwave, it's supposed to be better.) https://github.com/refile/refile

Se also: https://ruby5.codeschool.com/episodes/626-episode-583-september-15th-2015/stories/4952-best-rails-image-uploader

rewritten avatar Dec 14 '15 11:12 rewritten

Also for avatars there is a neat and free option at avatars.io (supports getting avatars from social networks, gravatar and even almost transparent uploads)

rewritten avatar Dec 14 '15 11:12 rewritten

thanks @rewritten nice inputs!

on criterias @andresgutgon , the first one should be: what we actually need, knowing the use cases and choosing the right tool. Community adoption is of course something to take in account but should not lead us to blindly adopt stuff.

enricostano avatar Dec 14 '15 11:12 enricostano

Thanks @rewritten nice!

@enricostano agree on put our needs before other criteria. But I think all those options are good for us. Aren't they?

andresgutgon avatar Dec 14 '15 11:12 andresgutgon

If all those options are good for us (still not sure though) we should choose the one that requires less dependencies. And after that we can talk about community adoption.

enricostano avatar Dec 14 '15 11:12 enricostano

If all those options are good for us (still not sure though) we should choose the one that requires less dependencies. And after that we can talk about community adoption.

Sounds good to me :+1:

andresgutgon avatar Dec 14 '15 11:12 andresgutgon

:heart_eyes:

enricostano avatar Dec 14 '15 11:12 enricostano

BTW just saying that experiment with webtorrent for managing our assets would super cool https://torrentfreak.com/webtorrent-brings-bittorrent-to-the-web-impresses-netflix-151213/ :trollface:

andresgutgon avatar Dec 14 '15 16:12 andresgutgon

LOL

enricostano avatar Dec 14 '15 16:12 enricostano

After taking a quick view into 3 candidates (refile, carrierwave and paperclip), I'd go with either paperclip or carrierwave, as they both have been around for a long time and heaily tested by the community.

Refile is pretty similar to paperclip, but also has sinatra as a dependency :scream:. IMHO seems too new for production (~ 1 year old) Carrierwave is more decoupled from AR and has only necessary dependencies, but if you want to use with Rails, it'll hack your models via AR::Model callbacks. I like the separated uploader class approach though. Paperclip is the classical choice, but maybe has more options than we really need. In the other side it's almost plug and play (very similar to carrierwave) and has interesting plugins like delayed_paperclip

Some metrics:

Open bugs count

  • Refile: 5
  • Carrierwave: 17
  • Paperclip: 9

Active since

  • Refile: Nov 2014
  • Carrierwave: March 2009
  • Paperclip: April 2008

edulan avatar Dec 14 '15 20:12 edulan

@edulan you are the man :clap: +1 for Paperclip

andresgutgon avatar Dec 15 '15 09:12 andresgutgon

Again we didn't analyzed our actual needs first :sob:

enricostano avatar Dec 15 '15 10:12 enricostano

Again we didn't analyzed our actual needs first

What are our needs? Are they special? or we just want being able to upload images to our models?

I think the second is a good start

andresgutgon avatar Dec 15 '15 11:12 andresgutgon

I think that Paperclip is too old actually

enricostano avatar Dec 15 '15 11:12 enricostano

I think that Paperclip is too old actually

Lol @enricostano that's a valid argument? How it's that related with "our actual needs"

andresgutgon avatar Dec 15 '15 11:12 andresgutgon

I was just playing the same game :trollface:

enricostano avatar Dec 15 '15 11:12 enricostano

Soooooooo, can we use Paperclip?

andresgutgon avatar Dec 15 '15 11:12 andresgutgon

Since all the available options have pretty nasty drawbacks and there is no neat and clean solution we can pick Paperclip. Democracy FTW :hand:

enricostano avatar Dec 15 '15 11:12 enricostano

Since all the available options have pretty nasty drawbacks

Well, it's sofware and it's Open Source. You know? ;)

andresgutgon avatar Dec 15 '15 11:12 andresgutgon

Can we prioritize this? I would add avatars (and uploads in general) after a first draft of the app.

I would like to see the basic workflow working even if not perfect from the UI point of view.

In the backend I would concentrate now on the following things:

  • background jobs
  • Mandrill integration for email delivery
  • Mailchimp integration for mailing list on sign up
  • missing endpoints

what do you think?

enricostano avatar Dec 15 '15 14:12 enricostano

I think having uploads is not a priority but a really nice to have. If @edulan want to do it would be great. And integrating in the front end should not be too difficult.

andresgutgon avatar Dec 15 '15 14:12 andresgutgon

It's not a #5min task IMHO, and we have more basic stuff missing.

Of course if @edulan doesn't like any other missing part and want to implement uploads he's more than welcome!

enricostano avatar Dec 15 '15 15:12 enricostano

I agree with @enricostano , we have too many basic things still to do. But in any case, I would go for CarrierWave. It's seems to be the more robust solution: https://infinum.co/the-capsized-eight/articles/best-rails-image-uploader-paperclip-carrierwave-refile

sauloperez avatar Dec 20 '15 18:12 sauloperez