Set Meta Data for Public Paperclip Images
Always set the cache control header for images that are going to be publicly served to allow taking advantage of browser caching.
has_attached_file :image,
:styles => { :large => "300x", :thumb => "100x", :small => "30x" },
:storage => :s3,
:s3_credentials => "config/s3.yml",
:s3_permissions => :public_read,
:s3_headers => { 'Cache-Control' => 'max-age=315576000', 'Expires' => 10.years.from_now.httpdate },
Written by Pritesh Jain
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#