Last active
December 15, 2015 15:09
-
-
Save hiroism007/5279795 to your computer and use it in GitHub Desktop.
amazonS3 + fog + carrierwave, fileupload setting.
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
CarrierWave.configure do |config| | |
config.fog_credentials = | |
:provider => 'AWS', | |
:aws_access_key_id => ENV["AWS_S3_KEY_ID"], | |
:aws_secret_access_key => ENV["AWS_S3_SECRET_KEY"] | |
} | |
config.fog_directory = ENV["AWS_S3_BUCKET"] | |
end |
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
# encoding: utf-8 | |
class ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::RMagick | |
storage Rails.env.production? ? :fog : :file | |
def cache_dir | |
"#{Rails.root}/tmp/uploads" | |
end | |
version :thumb do | |
process :resize_to_limit => [200, 200] | |
end | |
version :icon do | |
process :resize_to_fill => [64,64] | |
end | |
version :small_icon do | |
process :resize_to_fill => [32,32] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment