Skip to content

Instantly share code, notes, and snippets.

@quidproquo
Created April 20, 2012 19:52
Show Gist options
  • Save quidproquo/2431334 to your computer and use it in GitHub Desktop.
Save quidproquo/2431334 to your computer and use it in GitHub Desktop.
Cloudinary Uploader
# encoding: utf-8
class FloorPlanPhotoUploader < CarrierWave::Uploader::Base
include Cloudinary::CarrierWave
process :convert => :jpg
version :medium do
process :resize_and_pad => [280, 374, :white, 'West']
end
version :thumb do
process :resize_and_pad => [200, 200, :white, 'Center']
end
version :large do
process :resize_to_fit => [560, 800]
end
version :small do
process :resize_and_pad => [260, 360, :white, 'Center']
end
version :full do
process :resize_and_pad => [800, 800, :white, 'Center']
end
def default_url
"/assets/fallback/" + [version_name, "floorplan_logo.jpg"].compact.join('_')
end
end
@quidproquo
Copy link
Author

default_url is what is used by CarrierWave when no image has been defined so that broken images do not show up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment