Sha256: 36e8c9acc7d9fc8f961c7b910ef24311beaad3ab029e8e86cfc05d976ba072c1
Contents?: true
Size: 1004 Bytes
Versions: 1
Compression:
Stored size: 1004 Bytes
Contents
# encoding: utf-8 class AvatarUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file # storage :fog unless Rails.env.test? or Rails.env.cucumber? def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end def default_url "/images/avatar_missing.png" end process :resize_to_limit => [500, 500] version :thumb do process :crop_and_resize => [100, 100] end def cache_dir "#{Rails.root}/tmp/uploads" end def extension_white_list %w(jpg jpeg gif png) end def crop_and_resize(width, height) return if !model.cropping? manipulate! do |img| img.crop model.crop_string img.resize "#{width}x#{height}" img = yield(img) if block_given? img end end # Override the filename of the uploaded files: # Avoid using model.id or version_name here, see uploader/store.rb for details. # def filename # "something.jpg" if original_filename # end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buddies_avatar-0.0.2 | app/uploaders/avatar_uploader.rb |