module Middleman::Extensions::Lorem::LoremObject
def image(size, options={})
-
(String)
-
Parameters:
-
options
(Hash
) -- -
size
(String
) --
def image(size, options={}) domain = options[:domain] || 'http://placehold.it' src = "#{domain}/#{size}" hex = %w(a b c d e f 0 1 2 3 4 5 6 7 8 9) background_color = options[:background_color] color = options[:color] if options[:random_color] background_color = hex.sample(6).join color = hex.sample(6).join end src << "/#{background_color.sub(/^#/, '')}" if background_color src << '/ccc' if background_color.nil? && color src << "/#{color.sub(/^#/, '')}" if color src << "&text=#{Rack::Utils.escape(options[:text])}" if options[:text] src end