A friend was having trouble with the photo-captcha mod he installed in phpBB. The photo-captcha mod basically presents users with a group of images and asks them to choose all images that fit a certain category (i.e., choose all cars). After installing the mod however (and fixing a couple of silly mistakes), only half of the images would show up. And it wasn't the same images not showing up, it was entirely random.
As is usually the case with debugging, I looked for a working example with which I could compare the non-working one. When I found a working photo-captcha mod, I noticed the images loaded more slowly and consistently than on the non-working example. It was as if the non-working example was on crack, while the working example was practicing yoga.
I compared HTTP headers, checked cache settings, and everything else I could think of, but nothing looked out of the ordinary. So I decided to try something. Why not force the mod to pause between loading each image?
So I opened /forum/includes/usercp_confirm.php
and modified it:
$image = $sub; @imagegammacorrect($image, 1.0, (0.5 + mt_rand(0,1200)*0.001)); header('Content-Type: image/jpg'); header('Cache-control: no-cache, no-store'); @imagepng($image); // -------- EDIT BY RAAM -------- sleep(1); // -------- END EDIT --------- exit;
And it worked! The code paused for 1 second between loading each image and all the images loaded properly. I have no idea what caused this problem but if you know please leave a comment! And if you're having this same issue, at least now you have a solution. 🙂
Thanks again. I posted your advice on the phpbb forums for that mod so that others with that problem might benefit from it.
http://www.phpbb.com/community/viewtopic.php?f=15&t=472754&p=3199667#p3199667
Anytime Bob! I’m glad I could help! 🙂
It didn’t help for me but i commented (aka deleted) row
@imagegammacorrect($image, 1.0, (0.5 + mt_rand(0,1200)*0.001));
And it probably helped. Not 100% sure.
PS: Yea this is old.
Thanks for the comment, Jussi!
If I come across this problem again I’ll definitely try commenting out that line before adding
sleep(1)
. Apparently,imagegammacorrect()
is a GD function in PHP, so if GD hasn’t been turned on in your installation of PHP that could be the problem.well, hi admin adn people nice forum indeed. how’s life? hope it’s introduce branch 😉
Nothing seems to be easier than seeing someone whom you can help but not helping.
I suggest we start giving it a try. Give love to the ones that need it.
God will appreciate it.