Created
December 18, 2022 21:36
-
-
Save MilesCranmer/c5c7bbbdc61fa59b984bf22a8aaa7c89 to your computer and use it in GitHub Desktop.
Generate captcha text to hide text from bots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use Gregwar\Captcha\CaptchaBuilder; | |
// Create a captcha with the text "[email protected]" | |
$builder = new CaptchaBuilder('[email protected]'); | |
$builder->setMaxBehindLines(10); | |
$builder->setMaxFrontLines(10); | |
// Change the "font" to wherever your desired font file is | |
$builder->build($width=2000, $height=800, $font='/Users/mcranmer/Library/Fonts/Roboto-Regular.ttf'); | |
$builder->save('out.jpg', $quality=100); |
In case it's still legible to OCR, you can increase the number of lines by changing the 10
s. You can also change the font.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions:
brew install php composer
).composer require gregwar/captcha
to install gregwar's captcha library.'[email protected]'
) to your desired text.php create_captcha_text.php
in the terminal.The image is
out.jpg
.