I have an S3 bucket setup already, it contains images of a photo gallery, uploaded from my Rails app using PaperClip. Images are accessible via some arbitrary URLs like: http://s3.amazonaws.com/oldbucket/images/files/000/001/920/original/40a6885fc09c8ed4e1e3745d7f7fb770.jpg?1415766995 .
Kindly advice me the best option considering following requirements:
Any options using Rails gem or software that would do above would be helpful.
Thanks
For this you need to add carrierwave
gem for saving image from remote url. You can also do with paperclip.
First create a seed file without adding carrierwave uploader to your app. I am considering User as model and avatar as image.
User.all.each{|u| puts user.avatar.url}`
Now remove paperclip
and add carrierwave
This will give you list of all images. Now add it to seed file for model you want to add this images.
class Modelx
mount_uploader :avatar, AvatarUploader
end
So your seed file should have entries like.
Modelx.create([{:avatar_remote_url => image_url1}, {:avatar_remote_url => image_url2},.....])
You can set specific path and also create multiple dimension images using carrierwave.
REfrence url for carrierwave here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.