class C80Yax::Watermarker
Public Class Methods
new(original_path, watermark_path)
click to toggle source
# File lib/c80_yax/watermarker.rb, line 4 def initialize(original_path, watermark_path) @original_path = original_path.to_s @watermark_path = watermark_path.to_s end
Public Instance Methods
watermark!(options={})
click to toggle source
# File lib/c80_yax/watermarker.rb, line 9 def watermark!(options={}) options[:gravity] ||= 'center' image = MiniMagick::Image.open(@original_path) watermark_image = MiniMagick::Image.open(@watermark_path) result = image.composite(watermark_image) do |c| c.gravity options[:gravity] end result.write @original_path end