PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Grafische Sicherheitsüberprüfung-Farbe?


Markus2
15.09.2005, 17:04
Hallo

Kann man die Farben (Hintergrund und Text) der grafischen Sicherheitsüberprüfung ändern?

Ich habe folgendes in der Datei "image.php" (vers.3.0.9) gesehen:


// *********************************************************
// create foreground and background colours from a selection
$colors = array(
1 => array('255,255,255', '0,0,0'), // black on white
2 => array('0,0,0', '255,255,255'), // white on black
#3 => array('255,0,0', '255,255,0'), // yellow on red
#4 => array('255,255,0', '255,0,0'), // red on yellow
#5 => array('255,128,0', '50,50,255'), // blue on orange
#6 => array('50,50,255', '255,128,0'), // orange on blue
);
mt_srand((double)microtime() * 1000000);
$randcolor = mt_rand(1, sizeof($colors));
$bg = explode(',', $colors["$randcolor"][0]);
$fg = explode(',', $colors["$randcolor"][1]);
// end colour selection
// *********************************************************

$background_color = imagecolorallocate($temp, $bg[0], $bg[1], $bg[2]); //white background
imagefill($temp, 0, 0, $background_color); // For GD2+
$text_color = imagecolorallocate($temp, $fg[0], $fg[1], $fg[2]); //black text

imagestring($temp, 5, 0, 2, $string, $text_color);
imagecopyresized($image, $temp, 0, 0, 0, 0, $image_width, $image_height, $temp_width, $temp_height);
imagedestroy($temp);

$background_color = imagecolorallocate($image, $bg[0], $bg[1], $bg[2]); //white background
$text_color = imagecolorallocate($image, $fg[0], $fg[1], $fg[2]); //black text


Danke

StGaensler
15.09.2005, 17:54
Ja, bearbeite einfach die Zelen "1 => array('255,255,255', '0,0,0'), // black on white" und folgende. Die erste Kombination gibt die Hintergrundfarbe an, die zweite die Vordergrundfarbe. Aus den nicht auskommentierten Zeilen wird dann zufällig eine ausgewählt.