<?php
$font_size = 30;
$image_width = 100;
$image_height = 40;
$image = imagecreate($image_width, $image_height);
imagecolorallocate($image, 226, 226, 226);
$font_color = imagecolorallocate($image, 255, 0, 0);
$line_color = imagecolorallocate($image, 0, 0, 0);
for ($i=0; $i <40 ; $i++) {
$x1 = rand(1, 100);
$y1 = rand(1, 100);
$x2 = rand(1, 100);
$y2 = rand(1, 100);
imageline($image, $x1, $y1, $x2, $y2, $line_color);
}
imagettftext($image, $font_size, 0, 10, 30, $font_color, 'font/captcha_font.ttf', $text);
// imagestring($image, 4, 20, 10, $text, $font_color);
imagejpeg($image);
preferences:
30.7 ms | 402 KiB | 5 Q