Sha256: a9a25ecb7f3ac0b91b5f09ae5239c8ac9daa76ff2eca4eefae1ede8a3f2fd364

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

require 'carrierwave/processing/mini_magick'

module Thredded
  class AttachmentUploader < CarrierWave::Uploader::Base
    include CarrierWave::MiniMagick
    storage Thredded.file_storage

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

    version :thumb, if: :image? do
      process :resize_to_fit => [90, 90]
    end

    version :mobile, if: :image? do
      process :resize_to_limit => [480, 2000]
    end

    def extension_white_list
      %w(jpg jpeg gif png pdf zip tgz txt)
    end

    protected

    def image?(new_file)
      new_file.content_type.include? 'image'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
thredded-0.0.12 app/uploaders/thredded/attachment_uploader.rb