module FFaker::Image

def url(size = '300x300', format = 'png', bg_color = :random, text_color = :random, text = nil)

def url(size = '300x300', format = 'png', bg_color = :random, text_color = :random, text = nil)
  check_size!(size)
  check_format!(format)
  bg_color = FFaker::Color.hex_code if bg_color == :random
  text_color = FFaker::Color.hex_code if text_color == :random
  text = CGI.escape(text.to_s)
  "https://via.placeholder.com/#{size}/#{bg_color}/#{text_color}.#{format}?text=#{text}"
end