-
-
Save traels/941ec9e865786484650e to your computer and use it in GitHub Desktop.
Spree 2.2 image on S3
This file contains 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
config.paperclip_defaults = { | |
:storage => :s3, | |
:s3_credentials => { | |
:bucket => 'BUCKET', | |
:access_key_id => 'S3_KEY', | |
:secret_access_key => 'S3_SECRET' | |
} | |
} | |
This file contains 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
Paperclip::Attachment.default_options[:s3_protocol] = "https" | |
Spree::Image.attachment_definitions[:attachment][:styles] = ActiveSupport::JSON.decode('{"mini":"48x48\u003E","small":"100x100\u003E","product":"240x240\u003E","large":"600x600\u003E"}').symbolize_keys! | |
Spree::Image.attachment_definitions[:attachment][:path] = " /#{Rails.env}/:id/:style/:basename.:extension" | |
Spree::Image.attachment_definitions[:attachment][:url] = '/spree/products/:id/:style/:basename.:extension' | |
Spree::Image.attachment_definitions[:attachment][:default_url] = '' | |
Spree::Image.attachment_definitions[:attachment][:default_style] = 'product' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not pretty, but working.
I have Rails.env in my path so I can use same bucket for all environments.
I can see that I've left out s3_host_alias, that is an error, will haunt men when I deploy this to my .eu version of the store, that uses an EU S3 bucket for images.