• When I run the “Secureimage PHP Requirements Test”, I get:

    PHP Version: 5.2.6
    System: Linux
    GD Support: Yes!
    GD Version: bundled (2.0.34 compatible)
    TTF Support (FreeType): Yes!
    JPEG Support: No
    PNG Support: Yes!
    GIF Read Support: Yes!
    GIF Create Support: Yes!
    Since you can see this...
    Secureimage Will Work!!

    So I left it at that, even though the JPEG Support was at No.

    But I now noticed that sometimes, the CAPTCHA image would be blank.
    Digging into the plugin code, I found that this happened when a JPEG background was picked for the background directory.
    To solve this, here’s the modified code:

    function getBackgroundFromDirectory()
    ...
    while (($file = readdir($dh)) !== false) {
      $supported_formats = array();
      $gd_support = extension_loaded('gd');
      if ($gd_support) $gd_info = gd_info(); else $gd_info = array();
      if ($gd_support && $gd_info['JPG Support']) $supported_formats[] = 'jpg';
      if ($gd_support && $gd_info['PNG Support']) $supported_formats[] = 'png';
      if ($gd_support && $gd_info['GIF Create Support']) $supported_formats[] = 'gif';
      if (preg_match('/('.implode('|', $supported_formats).')$/i', $file)) $images[] = $file;
    }

    That way, only the supported image types will be used for backgrounds.

    Thanks for the nice plugin.

    Cheers.

    https://www.ads-software.com/extend/plugins/si-captcha-for-wordpress/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: SI CAPTCHA Anti-Spam] Suggested code improvement’ is closed to new replies.