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.2.0 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.2.0.rc2 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.2.0.rc1 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.2.0.beta2 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.2.0.beta1 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.2.0.beta app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.1.4 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.1.3 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.1.2 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.1.1 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.1.0 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.26 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.25 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.24 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.23 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.22 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.21 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.20 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.19 app/uploaders/uploadbox/image_processing_uploader.rb
uploadbox-0.0.18 app/uploaders/uploadbox/image_processing_uploader.rb