Page 1 of 1
Captcha image broken
Posted: 17 Jul 2012, 14:53
by Riton
In my guestbook vs 1.5.3 the Captcha images appear as broken images.
Only when i use TTF captcha once every 4 to 5 clicks on renew captcha give a picture.
Other methods don“t work at all.
Please help
PS. When i disable SEF everything works.
Re: Captcha image broken
Posted: 17 Jul 2012, 22:03
by Jan
Hi, the captcha displaying is not related to SEF features, so there should be not a problem, try to test your server path settings and try to see similar posts in this forum - there are different guides to solve similar problems.
Jan
Re: Captcha image broken
Posted: 03 Aug 2012, 12:33
by Riton
I found the error (with great help from my provider).
There is a faulty funtion in the helper file phocaguestbookcaptcha.php.
The mt_rand call on line 83 will sometimes have a min value greater than the max value. In later than 5.3.3 PHP versions this gives a fatal error and no image and characters are shown. (min-max check added in PHP 5.3.4)
Fixed the $rand_2 to range between 1 and 6 and deducted 3 from $rand at the end of the function.
Code: Select all
function getRandomPositionX($i) {
$rand_2 = mt_rand(1,6);
$rand_3 = $i + ($rand_2);
$rand = mt_rand($i,$rand_3);
$rand = $rand -3;
return $rand;
}
Problem solved....
PS: I see now that in an earlier post you solved the problem by checking if MIN value > Max value etc.
I think my way is easier and needs no extra loops or tries to generate the Captcha images.
Re: Captcha image broken
Posted: 14 Aug 2012, 12:46
by Jan
Ok