ich bin dabei mir ein eigenes captcha zu schreiben, was soweit auch funktioniert... Ich würde jetzt nurnoch gerne für jeden Buchstaben eine andere Farbe benutzen... ich habe auf php.net geguckt und einige funktionien wie imagechar(); gefunden, jedoch weiß ich nicht wie ich das umsetzen muss...
edit: Wenn vllt. noch jemand wüsste wie ich für jeden Einzelnen Buchstaben auch die Schriftart ändern könnte, dann wäre das perfekt.
Code: Alles auswählen
$zahl = '';
for ($i = 0; $i < 4; $i++)
{
mt_srand(make_seed());
$zahl .= mt_rand(0, 9);
}
$text = $zahl;
$bg_imga = 'bg/bg_1.png';
$col_r = 0;
$col_g = 0;
$col_b = 0;
$ttfsize = 26;
$text_x = 22;
$text_y = 54;
mt_srand(make_seed());
$angle = mt_rand(0, 10);
$fonts_array = array('font', 'trekker_regular', 'assimila', 'elephant', 'swash_normal');
mt_srand(make_seed());
$font = mt_rand(0, count($fonts_array)-1);
$ttf = 'font/' . $fonts_array[$font] . '.ttf';
header('Content-type: image/png');
$img = ImageCreateFromPNG($bg_imga);
$color = ImageColorAllocate($img, $col_r, $col_g, $col_b);
imagettftext($img, $ttfsize, $angle, $text_x, $text_y, $color, $ttf, $text);
imagepng($img);
imagedestroy($img);