Sha256: c1057b98a0a615fccbcd68841a63d270375b5a744f246c2c31e573ced074df5c

Contents?: true

Size: 1.43 KB

Versions: 10

Compression:

Stored size: 1.43 KB

Contents

# encoding: utf-8

class ImageUploader < AssetUploader

  include CarrierWave::MimeTypes
  # Include RMagick or MiniMagick support:
  include CarrierWave::RMagick

  # More reliable content types
  process :set_content_type

  # 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

  # Provide a default URL as a default if there hasn't been a file uploaded:
  # def default_url
  #   # For Rails 3.1+ asset pipeline compatibility:
  #   # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
  #
  #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
  # end

  version :preview do
    process :resize_to_fill => [150, 150]
  end

  # Process files as they are uploaded:
  # process :scale => [200, 300]
  #
  # def scale(width, height)
  #   # do something
  # end

  # Create different versions of your uploaded files:
  # version :thumb do
  #   process :scale => [50, 50]
  # 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

  # Override the filename of the uploaded files:
  # Avoid using model.id or version_name here, see uploader/store.rb for details.
  # def filename
  #   "something.jpg" if original_filename
  # end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
assetable-0.3.1 app/uploaders/image_uploader.rb
assetable-0.3.0 app/uploaders/image_uploader.rb
assetable-0.2.4 app/uploaders/image_uploader.rb
assetable-0.2.2 app/uploaders/image_uploader.rb
assetable-0.2.1 app/uploaders/image_uploader.rb
assetable-0.1.10 app/uploaders/image_uploader.rb
assetable-0.1.9 app/uploaders/image_uploader.rb
assetable-0.1.8 app/uploaders/image_uploader.rb
assetable-0.1.7 app/uploaders/image_uploader.rb
assetable-0.1.6 app/uploaders/image_uploader.rb