Skip to content

Instantly share code, notes, and snippets.

@etaque
Created March 2, 2010 17:54
Show Gist options
  • Save etaque/319718 to your computer and use it in GitHub Desktop.
Save etaque/319718 to your computer and use it in GitHub Desktop.
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
def store_dir
"assets/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_fill => [60, 60]
end
version :medium do
process :resize_to_fit => [200, 120]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end
class Profile < ActiveRecord::Base
mount_uploader :avatar, AvatarUploader
# Usual stuff...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment