WordPress.org

Support

Support » Plugins and Hacks » Really Simple CAPTCHA » Transparent/alpha background patch provided

Transparent/alpha background patch provided

  • Nowadays it is desired to have images with alpha (transparent background) and would be nice if Really Simple Captcha did the same for the PNG and GIF outputs.

    I hacked your code to achieve this, which is really easy. Just replace these lines:

    if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
        $bg = imagecolorallocate( $im, $this->bg[0], $this->bg[1], $this->bg[2] );

    with these:

    if ( $im = imagecreatetruecolor( $this->img_size[0], $this->img_size[1] ) ) {
        imagesavealpha($im, true);
        imagealphablending($im, false);
        $bg = imagecolorallocatealpha( $im, $this->bg[0], $this->bg[1], $this->bg[2], 127 );

    You can add the alpha value (4th param) to the class property. I didn’t bother.

    Hope you’ll implement it in the next version … is there going to be a next version? The plugins page still says it’s compatible up to WP 3.3.2, which is already ancient now.

    Cheers.

    http://wordpress.org/extend/plugins/really-simple-captcha/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thanks for posting the code normadize, it works a treat and is just what I was looking for.

    plugins -> editor -> Really Simple Captcha -> really-simple-captcha/really-simple-captcha.php

    /* Background color of CAPTCHA image. RGB color 0-255 */
    $this->bg = array( 255, 255, 255 );

    you can change it to bg color(rgb). hex to rgb converter

    normadize

    @normadize

    @fannur: the issue I posted about is how to make it transparent, not how to change the color.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Transparent/alpha background patch provided’ is closed to new replies.
Skip to toolbar