Buy Now
Sign in

Transparent Captcha background?

ChosenAnointed , July 31 2013
C
ChosenAnointed
Hi there,

Can anyone point me in the right direction for getting the white block behind the Captcha letters TRANSPARENT?

I've read a post that showed how to change the color of that block in the chrono_verification.php file, but I need it to be TRANSPARENT because I often have multiple forms on a site and sometimes one form would be on a white background and one on a coloured background on the same site, so I can't just change the main color of the block, I need it to be transparent so it can work on any background on the same site.

The line that controls the color is:
$white = imagecolorallocate($im, 255, 255, 255);

If the rgb values were rgba I would be able to add a transparency value of 0, but it only reads rgb.

Any idea how I can get that block to be transparent?
GreyHead
Hi ChosenAnointed,

Please try this, it might work.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
C
ChosenAnointed
Thank you Bob, that's a step in the right direction.

For some reason however, when I apply levels of transparency, it's like there is a black block behind the white, so it shows black when it's completely transparent, instead of showing the background color on the website.
The background.png image is fully transparent, so it shouldn't be the cause.

Here's a link to the test site: http://www.topshelfcompany.co.za/test/
It's the Quick Contact form on the right that I need the transparent background for. The other form is on the Online Order page, there the background of the page is white.

The Alpha value for the white is currently set at 20 - so you'll see on both forms it's a light grey instead of going transparent and showing the page's background colour.
$white = imagecolorallocatealpha($im, 255, 255, 255, 20);

The rest of the code in chrono_verification.php is the original, I haven't changed anything else.

Any further advice would really be appreciated.
GreyHead
Hi ChosenAnointed,

The PHP manual here says that imagecreatetruecolor() creates a black image. In the comments section someone has posted this suggestion:
// Creates a transparent image rather than the default black image
function imageCreateTransparent($x, $y) {
$imageOut = imagecreate($x, $y);
$colourBlack = imagecolorallocate($imageOut, 0, 0, 0);
imagecolortransparent($imageOut, $colourBlack);
return $imageOut;
}
Not tested and may not work . . .

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
C
ChosenAnointed
Hi GreyHead,

Thank you for that, but I've played around with it a bit and I don't think I'm implementing it correctly because it's not working. I'm no expert in PHP, so that's a bit of a drawback for me.
GreyHead
Hi ChosenAnointed,

Then the best option may be to find a way to live with the white background :-(

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much