How to assign a remote file to Carrierwave? How to assign a remote file to Carrierwave? ruby-on-rails ruby-on-rails

How to assign a remote file to Carrierwave?


You can do the following:

@video.remote_attachment_thumbnail_url = 'https://bucket_name.s3.amazonaws.com/uploads/users/1/video/1/thumb.png'

But that will cause Carrierwave to download + reprocess the file rather than just make it the thumbnail. If you're not going to use Carrierwave's processing, then it might make more sense to just store the URL to the thumbnail on the model rather than even using Carrierwave.


This worked for me, with CarrierWave 0.5.8

model.update_attributes(:remote_uploader_url => "http://path/to/image.jpg")

Of course, you need to set remote_uploader_url to be attr_accessible for this.


I was looking for this as well.

The blocking point in the zencoder case would be that Carrierwave doesn't track different different file type versions for the original file. It only references the original file.

So having the original file as an .mp4 a a thumbnail version as a .png doesn't work.While you can have an 'image.png' and also track 'thumb_png_image.png', you can't also create a 'thumb_jpg_image.jpg' for the same file.

Otherwise you could create a dummy version and using conditional versioning tell CW not to process it.Since CW would create the dummy version anyway but not upload it, you could have it reference a path matching the file returned by Zencoder. But oh well...