I am developing an admin panel for a legacy database which has images stored on S3. The way this is done is a full url pointing out to the resource on S3 which is publicly readable.
Paperclip store this in different fields in a database. I need to do these steps.
My only requirement is uploading single image file and storing it in a single field as explained. Dont care which lib I use.
My questions are
These may be basic questions but I am a ROR newbie! Guidance and help is much appreciated.
Instead of using paperclip I used carrierwave and fog. Which gives the ability to override name and storage location etc.
storage :fog
def initialize(*)
super
self.fog_directory = ENV['S3_BUCKET_NAME']
end
def store_dir
'pronunciations'
end
def cache_dir
"#{Rails.root}/tmp/uploads/pronunciations"
end
def extension_white_list
%w(mp3 m4a)
end
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.