Sha256: 56ff218d276075c0a1c8f6aed5bef85afa8eb8e74bd23cf38648534af4eb33cc

Contents?: true

Size: 700 Bytes

Versions: 35

Compression:

Stored size: 700 Bytes

Contents

module Uploadbox
  class ImageProcessingUploader < CarrierWave::Uploader::Base
    include CarrierWave::MimeTypes
    include CarrierWave::MiniMagick
    include CarrierWave::Processing::MiniMagick

    process :set_content_type
    process :strip

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

    def extension_white_list
      %w(jpg jpeg gif png)
    end

    def filename
      if original_filename
        extension = File.extname(original_filename)
        name = File.basename(original_filename, extension).parameterize.dasherize
        "#{name}#{extension}"
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
uploadbox-0.0.17 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.16 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.15 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.14 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.13 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.12 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.11 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.10 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.9 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.8 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.7 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.6 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.5 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.4 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.3 app/uploaders/uploadbox/image_processing_uploader.rb