Sha256: bf6a761d23da0e187165d20cc81834156fb842a978c9b77eaa0e735e2f11754a

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

# encoding: utf-8
require 'carrierwave'
require 'carrierwave/processing/mime_types'
require 'carrierwave/orm/activerecord'

class ThumbnailImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MimeTypes
  process :set_content_type

  include Sprockets::Helpers::RailsHelper
  include Sprockets::Helpers::IsolatedHelper

  # include CarrierWave::RMagick
  include CarrierWave::MiniMagick

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

  def default_url
    asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
  end

  version :small do
    process resize_to_fit: [200, 200]
  end

  version :thumb, from_version: :small do
    process resize_to_fill: [48, 48]
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flms-0.9.0 app/uploaders/thumbnail_image_uploader.rb
flms-0.1.0 app/uploaders/thumbnail_image_uploader.rb