diff --git image_captcha/image_captcha.admin.inc image_captcha/image_captcha.admin.inc index d15714e..de9f7ef 100644 --- image_captcha/image_captcha.admin.inc +++ image_captcha/image_captcha.admin.inc @@ -59,6 +59,12 @@ function image_captcha_settings_form() { '#default_value' => (int) variable_get('image_captcha_code_length', 5), '#description' => t('The code length influences the size of the image. Note that larger values make the image generation more CPU intensive.'), ); + $form['image_captcha_code_settings']['image_captcha_direction'] = array( + '#type' => 'checkbox', + '#title' => t('RTL direction for RTL languages'), + '#default_value' => variable_get('image_captcha_direction', 0), + '#description' => t('This option will cause characters in captcha image to start from the right if the current language is RTL.'), + ); // Font related stuff. $form['image_captcha_font_settings'] = _image_captcha_settings_form_font_section(); diff --git image_captcha/image_captcha.user.inc image_captcha/image_captcha.user.inc index 2a9a8e5..815c365 100644 --- image_captcha/image_captcha.user.inc +++ image_captcha/image_captcha.user.inc @@ -254,6 +254,10 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $ $ccage_width = $width / $character_quantity; $ccage_height = $height; + global $language; + if ($language->direction && ((bool) variable_get('image_captcha_direction', FALSE))) { + $characters = array_reverse($characters); + } foreach ($characters as $c => $character) { // initial position of character: in the center of its cage $center_x = ($c + 0.5) * $ccage_width;