cleverweb-cz / text-3d-captcha
简单的轴测3D文本验证码
v1.0.1
2024-03-28 16:37 UTC
Requires
- php: ^8.0
- ext-gd: *
Requires (Dev)
- phpunit/phpunit: ~10.0.10
This package is auto-updated.
Last update: 2024-09-28 17:54:48 UTC
README
简单的轴测3D文本验证码
- 创建一个轴测字母投影,对于OCR来说难以阅读,但对于人类来说很容易。
- 使用PHP GD库的内置位图字体来创建源高度图数组。
- 在源图上应用随机噪声,使得结果不是确定的。
- 输出是栅格PNG或矢量SVG。
先决条件
- PHP 8.0+
- GD库
安装
安装此库的首选方法是使用Composer
composer require cleverweb-cz/text-3d-captcha
用法
基本
$map = new GdFont('ABCD 123'); $image = new Svg(new Axonometry($map)); header('Content-Type: '.Svg::getMimeType()); $image->save(); // Output to browser
自定义
/** * noise = 0 * padding = 0.2 (20%) * emboss height volume = 0.7 (70%) */ $map = new GdFont('ABCD 123', 0, .2, .7); /** * Projection scale = 6x * Projection angle = 1.57 rad (90 deg) * Foreground color = red * Background color = gray */ $image = new Png(new Axonometry($map, 6., 1.57), 0xff0000, 0xcccccc); header('Content-Type: '.Png::getMimeType()); $image->save(); // Output to browser
还可以查看/example
目录中的示例。