module RedactorRails::UploaderBase::InstanceMethods

Public Instance Methods

extract_content_type() click to toggle source
# File lib/redactor_rails/uploader_base.rb, line 39
def extract_content_type
  if file.content_type == 'application/octet-stream' || file.content_type.blank?
    content_type = MIME::Types.type_for(original_filename).first
  else
    content_type = file.content_type
  end

  model.data_content_type = content_type.to_s
end
quality(percentage) { |img| ... } click to toggle source

process :quality => 85

# File lib/redactor_rails/uploader_base.rb, line 31
def quality(percentage)
  manipulate! do |img|
    img.quality(percentage)
    img = yield(img) if block_given?
    img
  end
end
read_dimensions() click to toggle source
# File lib/redactor_rails/uploader_base.rb, line 53
def read_dimensions
  if model.image? && model.has_dimensions?
    magick = ::MiniMagick::Image.new(current_path)
    model.width, model.height = magick[:width], magick[:height]
  end
end
set_size() click to toggle source
# File lib/redactor_rails/uploader_base.rb, line 49
def set_size
  model.data_file_size = file.size
end
strip() { |img| ... } click to toggle source

process :strip

# File lib/redactor_rails/uploader_base.rb, line 22
def strip
  manipulate! do |img|
    img.strip
    img = yield(img) if block_given?
    img
  end
end