We're using Paperclip with the aws-sdk gem to store and display images in our Rails app:
class User < ActiveRecord::Base
has_attached_file :image,
storage: :s3,
s3_credentials: 'config/s3.yml',
s3_protocol: :https,
styles: {
curriculum: '120x120>',
medium: '600x600>',
thumb: '200x200>'
},
default_url: 'missing_photo.png'
end
If I then use <%= image_tag current_user.image.url %>
in an html.erb file, I get the following HTML: <img src="https://s3.amazonaws.com/<my_bucket>/users/images/000/000/001/medium/my_image.png?1419989041">
.
How do I get that https://s3.amazonaws.com/<my_bucket>
to be a custom URL like https://example.com
? I have my domain all setup in Cloudfront along with its SSL certificate.
I looked up in the Paperclip S3 Storage documentation. There's a :url
option, but nothing I write for that option seems to work.
s3_alias_url
do anyway? – Philippe