Last active
December 17, 2015 13:58
-
-
Save nhc/5620663 to your computer and use it in GitHub Desktop.
For when you don't have imagemagick on your development machine for whatever reason. This goes in your rails model and only applies styles if your in the Production environment. Also uses some stored S3 credentials for AWS S3 storage.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ModelName < ActiveRecord::Base | |
has_attached_file :avatar, :styles => lambda { |attachment| ( Rails.env.production? ) ? { :medium => "104x104", :small => "60x60" } : {} }, :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => "/:style/:id/:filename" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment