아래 코드는 원하는 것을하기위한 출발점입니다. 이렇게하면 게시 한 예제 이미지보다 훨씬 간단하게 출력됩니다. 여기
하는 4 생성 된 이미지 :
$im = imagecreatetruecolor(150, 75);
$bg = imagecolorallocate($im, 220, 220, 220);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// set background colour.
imagefilledrectangle($im, 0, 0, 150, 75, $bg);
// output text.
imagettftext($im, 35, 0, 10, 55, $black, 'arial.ttf', 'ABCD');
for ($i = 0; $i < 50; $i++) {
//imagefilledrectangle($im, $i + $i2, 5, $i + $i3, 70, $black);
imagesetthickness($im, rand(1, 5));
imagearc(
$im,
rand(1, 300), // x-coordinate of the center.
rand(1, 300), // y-coordinate of the center.
rand(1, 300), // The arc width.
rand(1, 300), // The arc height.
rand(1, 300), // The arc start angle, in degrees.
rand(1, 300), // The arc end angle, in degrees.
(rand(0, 1) ? $black : $white) // A color identifier.
);
}
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
:
당신이 정말 관심있는 유일한 부분은 for
루프이지만, 이것은 완전히 동작하는 예제입니다
for
루프의 제한과 rand()
호출의 최대 값을 조정하면 'dens Ø '를 표시합니다.
Why DownVotes? – user3452098
아마도 이미 작성한 코드를 제공하지 않았기 때문일 수 있습니다. – Darren
왜 librairies가 당신을 위해 그것을 할 수있을 때 우물을 다시 발명합니까? http://www.thefreecountry.com/php/captcha.shtml – fluminis