WordPress.org

Ready to get started?Download WordPress

Forums

Really Simple CAPTCHA
Transparent/alpha background + patch provided (4 posts)

  1. normadize
    Member
    Posted 1 year ago #

    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/

  2. Barnez
    Member
    Posted 1 year ago #

    Thanks for posting the code normadize, it works a treat and is just what I was looking for.

  3. fannur
    Member
    Posted 1 year ago #

    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

  4. normadize
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic