Commit 8cf500dd authored by soxofaan's avatar soxofaan

made noise level more fine grained

parent c83209c5
...@@ -196,10 +196,13 @@ function image_captcha_settings_form() { ...@@ -196,10 +196,13 @@ function image_captcha_settings_form() {
'#type' => 'select', '#type' => 'select',
'#title' => t('Noise level'), '#title' => t('Noise level'),
'#options' => array( '#options' => array(
2 => t('low'), 1 => t('1 - low'),
5 => t('normal'), 2 => '2',
7 => t('high'), 3 => t('3 - medium'),
10 => t('severe'), 4 => '4',
5 => t('5 - high'),
7 => '7',
10 => t('10 - severe'),
), ),
'#default_value' => (int) variable_get('image_captcha_noise_level', 5), '#default_value' => (int) variable_get('image_captcha_noise_level', 5),
); );
......
...@@ -213,7 +213,7 @@ function _image_captcha_image_generator_add_lines(&$image, $width, $height, $col ...@@ -213,7 +213,7 @@ function _image_captcha_image_generator_add_lines(&$image, $width, $height, $col
} }
function _image_captcha_image_generator_add_dots(&$image, $width, $height, $colors) { function _image_captcha_image_generator_add_dots(&$image, $width, $height, $colors) {
$noise_quantity = ($width * $height)/2.0 * ((int) variable_get('image_captcha_noise_level', 5)) / 10.0; $noise_quantity = $width * $height * ((int) variable_get('image_captcha_noise_level', 5)) / 10.0;
for ($i = 0; $i < $noise_quantity; $i++ ) { for ($i = 0; $i < $noise_quantity; $i++ ) {
imagesetpixel($image, mt_rand(0, $width), mt_rand(0, $height), $colors[array_rand($colors)]); imagesetpixel($image, mt_rand(0, $width), mt_rand(0, $height), $colors[array_rand($colors)]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment