Sha256: 3a2b90fe9d8d9768b29a0519b086815cb8560cb7b781d11a06a44af27989e584

Contents?: true

Size: 950 Bytes

Versions: 16

Compression:

Stored size: 950 Bytes

Contents

# encoding: utf-8
# CarrierWave uploader for +Picture+ model. 
class PictureUploader < CarrierWave::Uploader::Base

  include CarrierWave::RMagick

  # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
  # include Sprockets::Helpers::RailsHelper
  # include Sprockets::Helpers::IsolatedHelper

  # Choose what kind of storage to use for this uploader:
  storage :file

  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  # Generates +preview+ version.
  version :preview do
    resize_to_limit(400, 300)
  end

  # Add a white list of extensions which are allowed to be uploaded.
  # For images you might use something like this:
  def extension_white_list
    %w(jpg jpeg gif png)
  end
  
  def root
    Rails.root.join 'public/'
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lines-engine-1.2.3 app/uploaders/picture_uploader.rb
lines-engine-1.2.2 app/uploaders/picture_uploader.rb
lines-engine-1.2.1.1 app/uploaders/picture_uploader.rb
lines-engine-1.2.1 app/uploaders/picture_uploader.rb
lines-engine-1.2 app/uploaders/picture_uploader.rb
lines-engine-1.1.5.3 app/uploaders/picture_uploader.rb
lines-engine-1.1.5.2 app/uploaders/picture_uploader.rb
lines-engine-1.1.5.1 app/uploaders/picture_uploader.rb
lines-engine-1.1.5 app/uploaders/picture_uploader.rb
lines-engine-1.1.4 app/uploaders/picture_uploader.rb
lines-engine-1.1.3 app/uploaders/picture_uploader.rb
lines-engine-1.1.2 app/uploaders/picture_uploader.rb
lines-engine-1.1.1 app/uploaders/picture_uploader.rb
lines-engine-1.1.0 app/uploaders/picture_uploader.rb
lines-engine-1.0.0 app/uploaders/picture_uploader.rb
lines-engine-0.9.0 app/uploaders/picture_uploader.rb