We are looking to support export of photos from our S3 location to users' Dropbox. Currently I am using the code like below:
@photo = Photo.find(id) #Photo.image has attachment
@photo.image.copy_to_local_file(nil, 'tmp/png/temp.png') #Get the file locally from S3
local_file = File.open('tmp/png/temp.png')
response = client.put_file('sample.png', local_file) # Then copy to Dropbox
The above method costs twice the bandwidth. Is there anyway I can transfer the images directly from S3 to Dropbox without copying them locally?
Thanks in advance!