Sha256: a319fdb602f066ecad0dd5973f4da06116bfab1319ac5b29a5a35c0532165301

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

# encoding: utf-8

class Shoppe::AttachmentUploader < CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick


  # 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

1 entries across 1 versions & 1 rubygems

Version Path
shoppe-1.1.2 app/uploaders/shoppe/attachment_uploader.rb