ruby on rails - Cant upload image from facebook carrierwave -
i have user profile allows users upload image file, crop data using jquery, send carrierwave/rmagick cropping/processing. it's working well.
the issue i'm running now, if user signs facebook (oauth), want set profile image facebook image default. want same field (talentprofile.profile_image) want users able swap out custom upload or remove if like.
here flow have currently:
- user signs facebook, user created.
- talentprofile resource created under user
- i go add profile_image after talentprofile creation.
here talent_profile.rb model:
class talentprofile < applicationrecord belongs_to :user mount_uploader :profile_image, profileimageuploader validates :profile_image, file_size: { less_than: 5.megabytes } def crop_profile_image if crop_x.present? profile_image.recreate_versions! end end def self.set_facebook_image(profileid, auth) @profile = talentprofile.find(profileid) @profile.profile_image = auth.info.image byebug end end when self.set_facebook_image run, seems @profile.profile_image can't set this, unless remove mount_uploader , validates lines. comes through nil, though auth.info.image url need. leading me believe carrierwave can't handle if update it; seems require form submission.
how can go making work? possible? information!
you should use remote_profile_image_url method upload images remote urls.
Comments
Post a Comment