also ich will für mich eine Umfrage schreiben, die dynamisch die %e als Bild ausgibt, dieses habe ich so gemacht:
Code: Alles auswählen
<?PHP
header('Content-type: image/png');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Umfrage</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?PHP
$antwort_1 = 25;
$antwort_2 = 1010;
$antwort_3 = 2;
$antwort_4 = 19;
function bild($variable,$a,$b,$c,$d)
{
$breite = $variable*100/$a+$b+$c+$d;
$width = $breite;
$height = 200;
$img = @ImageCreate($width, $height);
ImageColorAllocate($img, 255, 0, 0);
ImageFill($img, 0, 0, $black);
Imagepng($img);
}
echo "Antwort 1: ".bild($antwort_1,$antwort_1,$antwort_2,$antwort_3,$antwort_4)."%<br />";
echo "Antwort 2: ".bild($antwort_2,$antwort_1,$antwort_2,$antwort_3,$antwort_4)."%<br />";
echo "Antwort 3: ".bild($antwort_3,$antwort_1,$antwort_2,$antwort_3,$antwort_4)."%<br />";
echo "Antwort 4: ".bild($antwort_4,$antwort_1,$antwort_2,$antwort_3,$antwort_4)."%<br />";
?>
</body>
</html>
[quote]‰PNG IHDRkÈe þ