I have CarrierWave working fine through the typical ORM setup and upload via form. I would like to figure out how to use CarrierWave outside of the form submission context. For example, when a user registers I would like to grab their gravatar and store it with CarrierWave. Here’s what I have, and it does not work:
gravatar_url = "http://www.gravatar.com/avatar/#{Digest::MD5.new.update(current_user.email)}?s=512&d=identicon"
uploader = ImageUploader.new
uploader.store! gravatar_url
No error either. I’ve been looking around the web and have not been able to find a solution.
I’ve had lots of trouble trying to figure out how to get
store!to work with local file paths. It turns out thatstore!actually takes a file as a parameter, not a string.For the URL, you’ll need to
require 'open-uri'first, then open the file/url. Something like this should work:The same will work with a file path, but you don’t have to require
open-uriin that case.