Problem with captcha image

I've set up a new project, and now I have the problem, that captcha image initially only shows 1 letter. After a refresh, the image is correctly rendered.

Does anybody else have this problem?

Now it happens sometimes that there is no letter in captcha image.

Does anybody else have this problem?

Turn off your firebug and try again?

Quote

Turn off your firebug and try again?

Seems not to be a firebug problem, because Internet Explorer doesn't render anything for the first 3 or 4 times.

Would you please insert some debug code in CCaptchaAction::renderImage()? For example, file_put_contents('log.txt', $code), which is to save the verification code to a file. We need to make sure the verification code is correct first, and then check if the image is generated correctly.

Also, did you try some other servers?

Ok, I've wrote the captcha code to log.txt, the code was "viquze" but only a "v" was rendered in the image.

No, I've not tried some others servers, because this is our local developing machine, and in 2 other projects it works without any problems (on the same machine).

Good. That means the image generation code may have some issues on your platform. You may extract the code from renderImage() and save it into a PHP script. Then access that script directly and see if it works as expected. Also try saving the generated image into a file. That's all I can think about to debug the issue.

Quote

Good. That means the image generation code may have some issues on your platform. You may extract the code from renderImage() and save it into a PHP script. Then access that script directly and see if it works as expected. Also try saving the generated image into a file. That's all I can think about to debug the issue.

Ok, I'll try it and let you know what happens.

ok, I've updatet php to the current version (5.2.6), and there's still a problem with the number of rendered letters. so I wrote some of the calculated vars in a text file (only the first letter was rendered to the image), maybe you see a problem!?

would be great to get this issue fixed.

EDIT:

there seems to be a problem with the value in $box[2], sometimes there's a negative value, and in other cases (where the captcha image isn't rendered correctly) it contains the same value for each letter.

$box is obtained by imagettftext() which is part of GD2 extension. Did you try to reinstall that extension?

Quote

$box is obtained by imagettftext() which is part of GD2 extension. Did you try to reinstall that extension?

Yes I did. But this seems to be a bug in PHP:

http://www.mail-arch…/msg122302.html