Class | Fleximage::Operator::Border |
In: |
lib/fleximage/operator/border.rb
|
Parent: | Operator::Base |
Add a border to the outside of the image
image.border(options = {})
Use the following keys in the options hash:
Example:
@photo.operate do |image| # Defaults image.border( :size => 10, :color => 'white' # or color(255, 255, 255) ) # Big, pink and wide image.border( :size => '200x100', :color => color(255, 128, 128) ) end
# File lib/fleximage/operator/border.rb, line 33 33: def operate(options = {}) 34: options = options.symbolize_keys if options.respond_to?(:symbolize_keys) 35: defaults = { 36: :size => '10', 37: :color => 'white' 38: } 39: options = options.is_a?(Hash) ? defaults.update(options) : defaults 40: 41: # Get border size 42: options[:size] = size_to_xy(options[:size]) 43: 44: # apply border 45: @image.border!(options[:size][0], options[:size][1], options[:color]) 46: end