Sha256: e83be724657430dfee29dc4a66462ef6ba10da88c97d1f3e28ebd6b869f1515e

Contents?: true

Size: 605 Bytes

Versions: 4

Compression:

Stored size: 605 Bytes

Contents

# encoding: utf-8

class KktShoppe::AttachmentUploader < CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick

  storage :file

  # Where should files be stored?
  def store_dir
    "attachment/#{model.id}"
  end

  # Returns true if the file is an image
  def image?(new_file)
    self.file.content_type.include? 'image'
  end

  # Returns true if the file is not an image
  def not_image?(new_file)
    !self.file.content_type.include? 'image'
  end

  # Create different versions of your uploaded files:
  version :thumb, :if => :image? do
    process :resize_and_pad => [200, 200]
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kkt_shoppe-2.0.2 app/uploaders/kkt_shoppe/attachment_uploader.rb
kkt_shoppe-2.0.1 app/uploaders/kkt_shoppe/attachment_uploader.rb
kkt_shoppe-2.0.0 app/uploaders/kkt_shoppe/attachment_uploader.rb
kkt_shoppe-1.3.0 app/uploaders/kkt_shoppe/attachment_uploader.rb