I worked with this a bit (only with Paperclip).
There is one solution in order, but it requires a lot of processing.
If you want to hide your files from looping, you can hash the attachments of your clip, see this: https://github.com/thoughtbot/paperclip/wiki/Hashing
If you want to authorize the user every time you upload an image, you can do it as follows:
Extract files from your shared folder
has_attached_file :image, styles: { large: '1500x1500>', small: '250x250>'}, path: ':rails_root/storage/gallery/image/:style/:filename'
Use sendfile to view file
def show send_file(object.image.path(:small), filename: object.image_file_name, type: "image/png",disposition: 'inline',x_sendfile: true) end
However, I am a little reluctant to implement this, for example, a gallery of images, since each image requires GET -action + resolution. Using x-sendfile works with Apache to speed up image delivery.
Ref: http://apidock.com/rails/ActionController/Streaming/send_file
source share