Created
April 7, 2016 09:41
-
-
Save tibastral/633f57e01759d00fba0788800d2e2fbb to your computer and use it in GitHub Desktop.
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
class LogoUploader < CarrierWave::Uploader::Base | |
include Cloudinary::CarrierWave | |
def extension_white_list | |
%w(jpg jpeg gif png) | |
end | |
process :convert => 'png' | |
process :resize_to_limit => [1024, 1024] | |
version :thumbnail do | |
process :resize_to_fill => [770, 650] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
BIG_THUMBNAIL_DIMENSION = [800, 700] | |
version :big_thumbnail do | |
process :resize_to_fill => BIG_THUMBNAIL_DIMENSION | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
THUMBNAIL_RATIO = 700.0 / 800.0 | |
version :thumbnail_180w do | |
process :resize_to_fill => [180, (180 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
version :thumbnail_256w do | |
process :resize_to_fill => [256, (256 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
version :thumbnail_512w do | |
process :resize_to_fill => [512, (512 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
version :thumbnail_768w do | |
process :resize_to_fill => [768, (768 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
version :thumbnail_1024w do | |
process :resize_to_fill => [1024, (1024 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
version :thumbnail_1280w do | |
process :resize_to_fill => [1280, (1280 * THUMBNAIL_RATIO).to_i] | |
process convert: 'jpg' | |
cloudinary_transformation fetch_format: :auto, quality: '90' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment