crazy-max / cws-captcha
PHP class to generate a captcha to avoid spam.
Requires
- php: >=5.3.0
- ext-gd: *
- crazy-max/cws-debug: ~1.11
README
⚠️ Abandoned project
This project is not maintained anymore and is abandoned. Feel free to fork and make your own changes if needed.
Thanks to everyone for their valuable feedback and contributions.
About
PHP class to generate a captcha to avoid spam.
Installation
composer require crazy-max/cws-captcha
And download the code:
composer install # or update
Getting started
See tests/test.php
, tests/testCaptcha.php
files samples to help you.
To create a captcha, copy/edit testCaptcha.php
file and insert this in your HTML :
<img src="testCaptcha.php" />
Example
Methods
process - Process the captcha generation.
check - Static method that checks the captcha code entered.
getWidth - Captcha width in px.
setWidth - Set the captcha width in px.
getHeight - Captcha height in px.
setHeight - Set the captcha height in px.
getMinLength - Captcha minimum length.
setMinLength - Set the captcha minimum length.
getMaxLength - Captcha maximum length.
setMaxLength - Set the captcha maximum length.
getBgdColor - Hexadecimal background color.
setBgdColor - Set the hexadecimal background color.
getBgdTransparent - The background transparent for PNG image type.
setBgdTransparent - Set background transparent for PNG image type. If enabled, this will disable the background color.
getFgdColors - Hexadecimal foreground colors list for font letters.
setFgdColors - Set the Hexadecimal foreground colors list for font letters.
getFonts - Fonts definition (letter_space, min and max size, filename).
getMaxRotation - Max clockwise rotations for a letter.
setMaxRotation - Set the max clockwise rotations for a letter.
getPeriod - Generated image period (x, y).
setPeriod - Set the generated image period (x, y).
getAmplitude - Generated image amplitude (x, y).
setAmplitude - Set the generated image amplitude (x, y).
getBlur - The blur effect using the Gaussian method.
setBlur - Add blur effect using the Gaussian method.
getEmboss - The emboss effect.
setEmboss - Add emboss effect.
getPixelate - The pixelate effect.
setPixelate - Add pixelate effect.
getFormat - Image format.
setPngFormat - Set the png image format. (default)
setJpegFormat - Set the jpeg image format.
getError - The last error.
How can I help ?
All kinds of contributions are welcome 🙌! The most basic way to show your support is to star 🌟 the project, or to raise issues 💬 You can also support this project by becoming a sponsor on GitHub 👏 or by making a Paypal donation to ensure this journey continues indefinitely! 🚀
Thanks again for your support, it is much appreciated! 🙏
License
MIT. See LICENSE
for more details.