PHP code example of omranjamal / real-captcha

1. Go to this page and download the library: Download omranjamal/real-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/ */

    

omranjamal / real-captcha example snippets



$captcha = new omranjamal\RealCaptcha\RealCaptcha();

$captcha = new omranjamal\RealCaptcha\RealCaptcha();
$captcha->generate()->output("jpg");

$realCaptcha = new omranjamal\RealCaptcha\RealCaptcha(array(
    "height" = 200,
    "width" = 500,
    "number_of_words" = 2
));

$captcha = $realCaptcha->generate();
$captcha->output("jpg");

$realCaptcha = new omranjamal\RealCaptcha\RealCaptcha();

$realCaptcha->set(array(
    "height" = 200,
    "width" = 500,
    "number_of_words" = 2
));

$captcha = $realCaptcha->generate();
$captcha->output("jpg");

$realCaptcha = new omranjamal\RealCaptcha\RealCaptcha();

$captcha = $realCaptcha->generate(array(
    "height" = 200,
    "width" = 500,
    "number_of_words" = 2
));
$captcha->output("jpg");

$realCaptcha = new omranjamal\RealCaptcha\RealCaptcha();
$captcha = $realCaptcha->generate();

session_start();
$realCaptcha = new omranjamal\RealCaptcha\RealCaptcha();

$captcha = $realCaptcha->generate();
$_SESSION["captcha_text"] = $captcha->text;
$captcha->output("jpg",100);
$captcha->file("example.jpg","jpg",100);

$captcha = $realCaptcha->generate();
$captcha->file("file.jpg" ,"jpg", 90);

$captcha = new omranjamal\RealCaptcha\RealCaptcha(array(
    "background_color" => array(255,0,0), //Bright Red
    "text_color" => array(255,255,255) //White
));

$captcha->generate()->output("jpg");

$captcha = new omranjamal\RealCaptcha\RealCaptcha(array(
    "source" => realCaptcha::INPUT
));

$captcha->generate("Text")->output("jpg");

$captcha = new omranjamal\RealCaptcha\RealCaptcha();
$captcha->generate("Text", array("source" => realCaptcha::INPUT))->output("jpg");

$captcha->generate("Text")->output("jpg");
$captcha->generate(array("example","text"))->output("jpg");

$captcha = new omranjamal\RealCaptcha\RealCaptcha(array(
    "source" => realCaptcha::uFUNCTION
));

$captcha->textFunction(function(){
    return array("EXAMPLE","FUNCTION");
});

$captcha->generate()->output("jpg");