<?php
error_reporting(E_ALL);
header("Content-type: image/jpeg");
$code = $_GET["code"]; //anzuzeigender Code
$size = Array(300,30); //größe des Captcha
$fonts = Array("exitfont.ttf","turn.ttf"); //Schriftdateien
$colors = Array("backround"=>"255,255,255","foreground"=>"0,0,0"); //Farben
$angles = range(-20,20); //Winkelbereich für die Buchstaben
$size = range(16,20); //Schriftgröße der Buchstaben
$paddingx = 20; //x-Abstand der Buchstaben
$paddingy = range(5,15) //y-Abstand nach oben
$image = imagecreate($size[0],$size[1]); //Bild erstellen
$foregroundc = explode(",",$colors["foreground"]);
$foreground = imagecolorallocate($image,$foregroundc[0],$foregroundc[1],$foregroundc[2]);
$backgroundc = explode(",",$colors["background"]);
$background = imagecolorallocate($image,$backgroundc[0],$backgroundc[1],$backgroundc[2]);
//Hintergrund füllen
imagefilledrectangle($image,0,0,$size[0],$size[1],$background);
for($i = 0,$i < strlen($code); $i++) {
//Buchstaben auf das Bild schreiben
imagettftext($image,$size[array_rand($size)],$angles[array_rand($angles)],$paddingx*($i+1),$paddingy[array_rand($paddingy)],$foreground,$fonts[array_rand($fonts)],$code[$i]);
}
//Bild ausgeben
imagejpeg($image);
?>