Skip to content

Instantly share code, notes, and snippets.

@tibastral
Created April 7, 2016 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tibastral/633f57e01759d00fba0788800d2e2fbb to your computer and use it in GitHub Desktop.
Save tibastral/633f57e01759d00fba0788800d2e2fbb to your computer and use it in GitHub Desktop.
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