impress/app/models/outfit_image_uploader.rb
Matchu 7b5856ebf9 basic sharing
Sharing pane works, everything is great for guests. Logged in
users are on the way, since right now Share Outfit re-saves
anonymously rather than showing sharing data for the existing
outfit.
2012-07-17 12:15:04 -04:00

31 lines
757 B
Ruby

require 'carrierwave/processing/mime_types'
class OutfitImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MimeTypes
include CarrierWave::MiniMagick
# Settings for S3 storage. Will only be used on production.
fog_directory 'impress-outfit-images'
fog_attributes 'Cache-Control' => "max-age=#{15.minutes}",
'Content-Type' => 'image/png'
process :set_content_type
version :medium do
process :resize_to_fill => [300, 300]
end
version :small, :from_version => :medium do
process :resize_to_fill => [150, 150]
end
def filename
"thumb.png"
end
def store_dir
partition_id = model.id / 1000
partition_dir = "%03d" % partition_id
"outfits/#{partition_dir}/#{model.id}"
end
end