- <?php
- if (isset($_GET['height']))
- $height = $_GET['height'];
- else
- $height = 45;
- if (isset($_GET['color1']))
- $color1 = $_GET['color1'];
- else
- $color1 = "209F0B";
- if (isset($_GET['color2']))
- $color2 = $_GET['color2'];
- else
- $color2 = "60D154";
- if (isset($_GET['color3']))
- $color3 = $_GET['color3'];
- else
- $color3 = "404040";
- if (isset($_GET["value"]))
- {
- $value = $_GET["value"];
- $addval=0;
- $valuearray = explode(",", $value);
- $width = count($valuearray);
- $addval=max($valuearray);
- $moyadd=floor($addval/$height);
- for($i=0;$i<($width+1);$i++)
- {
- $newvalue=floor($valuearray[$i]/$moyadd);
- $value2[$i] = $height-$newvalue;
- }
- }
- $values[0] = 0;
- $values[1] = $height;
- for($i=0;$i<($width+1);$i++)
- {
- $values[$i*2+2] = $i;
- $values[$i*2+3] = $value2[$i];
- }
- $values[(($width*2)+2)] = (($width*2)+1);
- $values[(($width*2)+3)] = $height+1;
- //);
- $image = imagecreatetruecolor(($width+2), $height+1);
- $rouge1 = hexdec(substr($color1,0,2));
- $vert1 = hexdec(substr($color1,2,2));
- $bleu1 = hexdec(substr($color1,4,2));
- $rouge2 = hexdec(substr($color2,0,2));
- $vert2 = hexdec(substr($color2,2,2));
- $bleu2 = hexdec(substr($color2,4,2));
- $rouge3 = hexdec(substr($color3,0,2));
- $vert3 = hexdec(substr($color3,2,2));
- $bleu3 = hexdec(substr($color3,4,2));
- $line = imagecolorallocate($image, $rouge1, $vert1, $bleu1);
- $bg = imagecolorallocate($image, $rouge2, $vert2, $bleu2);
- $borderl = imagecolorallocate($image, $rouge3, $vert3, $bleu3);
- imagefilledpolygon($image, $values, ($width+2), $bg);
- imagepolygon($image, $values, ($width+2), $line);
- imagerectangle($image, 0, 0, $width+1, $height, $borderl);
- header('Content-type: image/png');
- imagecolortransparent($image,0);
- imagepng($image);
- imagedestroy($image);
- ?>