All threads / Is there a better solution that Paperclip to manage profile pictures ?

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Is there a better solution that Paperclip to manage profile pictures ?

Damian Nelwep asked in Gems / Libraries

Hi everyone,

I'm asking this question because it seems pretty hard to setup, between Image Magick and all the mecanics there is to put to work... I saw there was another solution Carrierwave but which seems as I read harder to install.

So in the end I tend to think it could be better to choose something simpler like Gravatar, except that the app I'm working on consists on people exposing portfolios with photos among other things... So anyways I will have to get a gem that permit uploading files on the user profiles...

Which solution do you suggest me the best, eventually the easiest possible but most of all, a working one.

Thank you in advance for your time and hoping you're having a good day

I would recommend Rails's ActiveStorage. I've done some episodes on it which you can checkout, but it's the official Rails file uploading library and definitely the easiest.

You'll still need to have imagemagick installed. They all use this for the actual cropping and resizing of images.

Carrierwave works too, but it requires some other setup like creating Uploaders so you can define how a file gets processed.

ActiveStorage works a bit different where you define how the file gets resized when you use it in your view. Carrierwave does this as soon as the file is uploaded instead. Both have some advantages but ActiveStorage should definitely be easier.

Ok thank you I'll get to the ressources you provide and I'm sure I'll find what I want. In the end I'll just delete everything about paperclip in the end since it doens't seem at all like the best way to do what I want. The easier the better :) thanks again !

I got some issue when I try to create a new post following your instructions.

ArgumentError in PostsController#create
Cannot load `Rails.config.active_storage.service`: unknown keyword: host

But I guess this is because of the subdomain's mecanics that is going on...
So in storage.yml, what should I put for the host: option..?

At first I put 'localhost:5000' and then 'lvh.me:5000' which return to me :

LoadError in PostsController#create
Unable to autoload constant ActiveStorage::Blob::Analyzable, expected /home/meaw/.rvm/gems/ruby-2.5.1/gems/activestorage-5.2.2/app/models/active_storage/blob/analyzable.rb to define it
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 33,399+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.