Sha256: 0be569a410f911a9fcee5e644e4e5497b12a0b4d9f2c42786c04f4b31be5a89b

Contents?: true

Size: 1.46 KB

Versions: 40

Compression:

Stored size: 1.46 KB

Contents

# encoding: utf-8
class RedactorRailsPictureUploader < CarrierWave::Uploader::Base
  include RedactorRails::Backend::CarrierWave

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

  # 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
    "system/redactor_assets/pictures/#{model.id}"
  end

  # Provide a default URL as a default if there hasn't been a file uploaded:
  # def default_url
  #   "/images/fallback/" + [version_name, "default.png"].compact.join('_')
  # end

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

  process :read_dimensions

  # Create different versions of your uploaded files:
  version :thumb do
    process :resize_to_fill => [118, 100]
  end

  version :content do
    process :resize_to_limit => [800, 800]
  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
    RedactorRails.image_file_types
  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

40 entries across 34 versions & 6 rubygems

Version Path
redactor-rails-fixes-0.5.0.1 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
rdrails5-0.5.1 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails4-0.5.0 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.5.0 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.4.5 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.4.4 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.7 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.7 lib/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.6 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.6 lib/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.5 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.5 lib/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.4 lib/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.4 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.3 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
th_simple_content_management-0.2.3 lib/redactor_rails_picture_uploader.rb
redactor-rails-0.4.3 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.4.2 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.4.1 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb
redactor-rails-0.3.7 lib/generators/redactor/templates/base/carrierwave/uploaders/redactor_rails_picture_uploader.rb