module AttachmentSaver::Processors::MiniMagick::Operations

Public Instance Methods

crop_to(new_width, new_height, &block) click to toggle source
# File lib/processors/mini_magick.rb, line 91
def crop_to(new_width, new_height, &block) # crops to the center
  left = (width - new_width)/2
  right = (height - new_height)/2
  image = dup
  image.crop("#{new_width}x#{new_height}+#{left}+#{right}", "+repage")
  image.extend Operations
  block.call(image)
end
file_type_extension() click to toggle source
# File lib/processors/mini_magick.rb, line 73
def file_type_extension
  case format.downcase
    when 'jpeg' then 'jpg'
    else format.downcase
  end
end
format() click to toggle source
# File lib/processors/mini_magick.rb, line 80
def format; @__format ||= self[:format]; end
height() click to toggle source
# File lib/processors/mini_magick.rb, line 82
def height; @__height ||= self[:height]; end
resize_to(new_width, new_height, &block) click to toggle source
# File lib/processors/mini_magick.rb, line 84
def resize_to(new_width, new_height, &block)
  image = dup
  image.resize("#{new_width}x#{new_height}!")
  image.extend Operations
  block.call(image)
end
width() click to toggle source
# File lib/processors/mini_magick.rb, line 81
def width;   @__width ||= self[:width];  end