ruby on rails - How to use carrierwave to process an image that was directly uploaded to Amazon s3? -
i have client upload image directly s3 javascript , have designed url if carrierwave uploading (by using unique_id pass create method). once image uploaded, want send ajax request create record, , process image using carrierwave, don't need carrierwave handle upload, process versions.
i have typical carrierwave setup using fog gem s3 storage:
class picture < activerecord::base mount_uploader :image, imageuploader # . . . end and this:
class imageuploader < carrierwave::uploader::base include carrierwave::rmagick storage :fog def store_dir "uploads/picture/#{model.unique_id}" end version :large resize_to_limit(600, 600) end # . . . end but can't figure out how create new picture without carrierwave wanting handle upload.
i have tried setting picture.image filename becomes nil:
>> picture.create(image: params[:filename], unique_id: params[:unique_id]) => #<picture id: 96, image: nil, ... > i have tried getting image using carrierwave's "uploading files remote location" feature:
class picturescontroller < applicationcontroller def create @picture = picture.create( remote_image_url: params[:url], unique_id: params[:unique_id] ) # . . . end # . . . end that works eventually, lot of downloading , uploading , feels wrong.
how create picture without carrierwave getting involved, , have carrierwave process image versions?
Comments
Post a Comment