Sha256: 7b29ed15336029dfb899d2d7a0ae1b41879c46e6ebc0a9d95a00db024857a1f5

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

module LoftAssetFileUploader
  extend ActiveSupport::Concern

  included do
    include CarrierWave::MiniMagick

    def store_dir
      "loft/#{ model._number }"
    end

    version :_40x40_2x, if: :is_image? do
      process :resize_to_fill => [80, 80]
    end

    version :_200x150_2x, if: :is_image? do
      process :resize_to_fill => [400, 300]
    end

    version :thumbnail, if: :is_image? do
      process :resize_to_fill => [320, 320]
    end

    version :small, if: :is_image? do
      process :resize_to_fit => [320, 320]
    end

    version :medium, if: :is_image? do
      process :resize_to_fit => [640, 640]
    end

    version :large, if: :is_image? do
      process :resize_to_fit => [1280, 1280]
    end

    def is_image? new_file
      model.is_image?
    end
    private :is_image?

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loft-0.4.1 app/models/concerns/loft_asset_file_uploader.rb
loft-0.4.0 app/models/concerns/loft_asset_file_uploader.rb