# encoding: utf-8

# IconUploader is class to process images
class IconUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick

  storage :fog if Rails.env.production?
  storage :file if Rails.env.development?

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  version :thumb do
    process resize_to_fit: [59, 75]
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

  CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/
end
