olympiamanagement/app/models/olympia_images_uploader.rb

35 lines
848 B
Ruby

# encoding: utf-8
require 'carrierwave/processing/mime_types'
require 'carrierwave/orm/activerecord'
class OlympiaImagesUploader < CarrierWave::Uploader::Base
include CarrierWave::MimeTypes
process :set_content_type
include CarrierWave::MiniMagick
include CarrierWave::MimeTypes
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# storage :s3
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
return "uploads/#{model.class.to_s.underscore}/olympia_students"
end
# override
def filename
@original_filename
end
def cache_dir
"#{Rails.root}/tmp/uploads"
end
end