diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-10-25 16:22:10 -0700 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-10-25 16:22:10 -0700 |
commit | 9e2b2a32fd0e967ad3184e9a5d091a29953acb91 (patch) | |
tree | 00822e24aa1110c73ca455a8d096ef296c008cbc /vendor/gregwar/captcha/demo | |
parent | c507c5416251c505cb3e088a03c6664bed73c812 (diff) |
Include composer dependencies in repo
Diffstat (limited to 'vendor/gregwar/captcha/demo')
-rw-r--r-- | vendor/gregwar/captcha/demo/demo.php | 14 | ||||
-rw-r--r-- | vendor/gregwar/captcha/demo/fingerprint.php | 15 | ||||
-rw-r--r-- | vendor/gregwar/captcha/demo/index.php | 15 | ||||
-rw-r--r-- | vendor/gregwar/captcha/demo/ocr.php | 42 | ||||
-rw-r--r-- | vendor/gregwar/captcha/demo/output.php | 15 |
5 files changed, 101 insertions, 0 deletions
diff --git a/vendor/gregwar/captcha/demo/demo.php b/vendor/gregwar/captcha/demo/demo.php new file mode 100644 index 00000000..7852745f --- /dev/null +++ b/vendor/gregwar/captcha/demo/demo.php @@ -0,0 +1,14 @@ +<?php + +include(__DIR__.'/../CaptchaBuilderInterface.php'); +include(__DIR__.'/../PhraseBuilderInterface.php'); +include(__DIR__.'/../CaptchaBuilder.php'); +include(__DIR__.'/../PhraseBuilder.php'); + +use Gregwar\Captcha\CaptchaBuilder; + +$captcha = new CaptchaBuilder; +$captcha + ->build() + ->save('out.jpg') +; diff --git a/vendor/gregwar/captcha/demo/fingerprint.php b/vendor/gregwar/captcha/demo/fingerprint.php new file mode 100644 index 00000000..ce30d991 --- /dev/null +++ b/vendor/gregwar/captcha/demo/fingerprint.php @@ -0,0 +1,15 @@ +<?php + +include(__DIR__.'/../CaptchaBuilderInterface.php'); +include(__DIR__.'/../PhraseBuilderInterface.php'); +include(__DIR__.'/../CaptchaBuilder.php'); +include(__DIR__.'/../PhraseBuilder.php'); + +use Gregwar\Captcha\CaptchaBuilder; + +echo count(CaptchaBuilder::create() + ->build() + ->getFingerprint() +); + +echo "\n"; diff --git a/vendor/gregwar/captcha/demo/index.php b/vendor/gregwar/captcha/demo/index.php new file mode 100644 index 00000000..e543883b --- /dev/null +++ b/vendor/gregwar/captcha/demo/index.php @@ -0,0 +1,15 @@ +<!DOCTYPE html> +<body> + <html> + <meta charset="utf-8" /> + </html> + <body> + <h1>Captchas gallery</h1> + <?php for ($x=0; $x<8; $x++) { ?> + <?php for ($y=0; $y<5; $y++) { ?> + <img src="output.php?n=<?php echo 5*$x+$y; ?>" /> + <?php } ?> + <br /> + <?php } ?> + </body> +</body> diff --git a/vendor/gregwar/captcha/demo/ocr.php b/vendor/gregwar/captcha/demo/ocr.php new file mode 100644 index 00000000..3d745f65 --- /dev/null +++ b/vendor/gregwar/captcha/demo/ocr.php @@ -0,0 +1,42 @@ +<?php + +include(__DIR__.'/../CaptchaBuilderInterface.php'); +include(__DIR__.'/../PhraseBuilderInterface.php'); +include(__DIR__.'/../CaptchaBuilder.php'); +include(__DIR__.'/../PhraseBuilder.php'); + +use Gregwar\Captcha\CaptchaBuilder; + +/** + * Generates 1000 captchas and try to read their code with the + * ocrad OCR + */ + +$tests = 10000; +$passed = 0; + +shell_exec('rm passed*.jpg'); + +for ($i=0; $i<$tests; $i++) { + echo "Captcha $i/$tests... "; + + $captcha = new CaptchaBuilder; + + $captcha + ->setDistortion(false) + ->build() + ; + + if ($captcha->isOCRReadable()) { + $passed++; + $captcha->save("passed$passed.jpg"); + echo "passed at ocr... "; + } else { + echo "failed... "; + } + + echo "pass rate: ".round(100*$passed/($i+1),2)."%\n"; +} + +echo "\n"; +echo "Over, $passed/$tests readed with OCR\n"; diff --git a/vendor/gregwar/captcha/demo/output.php b/vendor/gregwar/captcha/demo/output.php new file mode 100644 index 00000000..2a4f3303 --- /dev/null +++ b/vendor/gregwar/captcha/demo/output.php @@ -0,0 +1,15 @@ +<?php + +include(__DIR__.'/../CaptchaBuilderInterface.php'); +include(__DIR__.'/../PhraseBuilderInterface.php'); +include(__DIR__.'/../CaptchaBuilder.php'); +include(__DIR__.'/../PhraseBuilder.php'); + +use Gregwar\Captcha\CaptchaBuilder; + +header('Content-type: image/jpeg'); + +CaptchaBuilder::create() + ->build() + ->output() +; |