- Issue created by @jungKunwar
Also, I got this error on the console whenever I refresh the image.
http://local-local.docksal.site/image-captcha-generate/70/1690235624 500 (500 Service unavailable (with message)) Image (async) attr @ jquery.min.js?v=3.6.3:2 B @ jquery.min.js?v=3.6.3:2 attr @ jquery.min.js?v=3.6.3:2 (anonymous) @ image_captcha_refresh.js?v=9.5.9:33 c @ jquery.min.js?v=3.6.3:2 fireWith @ jquery.min.js?v=3.6.3:2 l @ jquery.min.js?v=3.6.3:2 (anonymous) @ jquery.min.js?v=3.6.3:2 load (async) send @ jquery.min.js?v=3.6.3:2 ajax @ jquery.min.js?v=3.6.3:2 E.<computed> @ jquery.min.js?v=3.6.3:2 (anonymous) @ image_captcha_refresh.js?v=9.5.9:28 dispatch @ jquery.min.js?v=3.6.3:2 y.handle @ jquery.min.js?v=3.6.3:2
any help will be appreciated.
Thank you.- 🇩🇪Germany Anybody Porta Westfalica
Thanks, could someone prepare a MR to fix this for the next release, combined with 🐛 Error float>int conversion after update to version 2.0.3 Fixed
- 🇮🇳India ayush.pandey
Tested the module with version 2.x-dev on Drupal 10 with PHP 8.1 and the issue seems to not reproducible (enabled on all forms).
That's weird. I also tried the
2.0.3 Version.
PHP: 8.1
Drupal: 9.5.9I will try with the 2.x-dev and keep update here.
- Status changed to Postponed: needs info
over 1 year ago 1:06pm 27 July 2023 - 🇩🇪Germany Anybody Porta Westfalica
@jungKunwar looks like a local issue. Please check and resave your image captcha settings.
What values do you use for- image_captcha_font_size
- image_captcha_character_spacing
and which font did you choose?
/**
* Helper function for calculating image height and width.
*
* They are based on given code and current font/spacing settings.
*
* @param string $code
* The utf8 string which will be used to split in characters.
*
* @return array
* [$width, $heigh].
*/
function _image_captcha_image_size($code) {
$config = \Drupal::config('image_captcha.settings');
$font_size = (int) $config->get('image_captcha_font_size');
$character_spacing = (float) $config->get('image_captcha_character_spacing');
$characters = _image_captcha_utf8_split($code);
$character_quantity = count($characters);// Calculate height and width.
$width = $character_spacing * $font_size * $character_quantity;
$height = 2 * $font_size;// Return the values as full pixel values (no floats):
return [(int) $width, (int) $height];
}