I don't think I'm having a problem with the image library GD2. The image is displaying correctly.

The problem appears to be with the routines that are passing the BBS generated captcha key to compare with what is entered by the user.

The BBS generated key is stored in the session file in the sessions directory. $captcha contains the properly entered captcha by the user. The code is failing to decide that they are equal for some reason.