Module: QuickCaptcha::ImageHelpers

Included in:
QuickCaptchaController
Defined in:
lib/quick_captcha/image_helpers.rb

Overview

:nodoc

Constant Summary collapse

IMAGE_STYLES =
[
  'embosed_silver',
  'simply_red',
  'simply_green',
  'simply_blue',
  'distorted_black',
  'all_black',
  'charcoal_grey',
  'almost_invisible'
]

Instance Method Summary collapse

Instance Method Details

#generate_simple_captcha_image(options = {}) ⇒ Object

:nodoc



6
7
8
9
10
11
12
13
14
# File 'lib/quick_captcha/image_helpers.rb', line 6

def generate_simple_captcha_image(options = {})
  options = QuickCaptcha.image_options.merge(options)
  key = options.delete(:simple_captcha_key)
  captcha_text = QuickCaptcha::CaptchaUtils.simple_captcha_value(key)
  options[:captcha_text] = captcha_text
  options[:distortion] = distortion(options[:distortion])
  options[:image_style] = image_style(options[:image_style])
  QuickCaptcha.backend.generate_simple_captcha_image(options)
end