PHP code example of woogoo / captcha

1. Go to this page and download the library: Download woogoo/captcha library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

woogoo / captcha example snippets




use WooGoo\Captcha;

$font = './captcha-font.ttf';

$captcha = new Captcha($font); // initialization, with a fully qualified TrueType font file

$captcha_string = $captcha->getCaptcha(); // retrieve your captcha string

$captcha_image = $captcha->getGraphicCaptcha(100, 40, 'png'); // define min-width and min-height of output image

header('Content-type: image/png');

echo $captcha_image; // output captcha image to browser