Просмотр файла forum/grafic.php

Размер файла: 1.11Kb
  1. <?php
  2. $perc=(int)$_GET['perc'];
  3. $perc2 = $perc;
  4. if($perc2=='100'){$perc2 = $perc-2;}
  5.  
  6.  
  7. header("Content-type: image/gif");
  8. $im = imageCreateFromGIF("img/grafic.gif");
  9. $color = imagecolorallocate($im, 234, 237, 237);
  10. $color2 = imagecolorallocate($im, 227, 222, 222);
  11. $color3 = imagecolorallocate($im, 204, 200, 200);
  12. $color4 = imagecolorallocate($im, 185, 181, 181);
  13. imagefilledrectangle ($im, 1, 1, 98, 2, $color);
  14. imagefilledrectangle ($im, 1, 3, 98, 4, $color2);
  15. imagefilledrectangle ($im, 1, 5, 98, 6, $color3);
  16. imagefilledrectangle ($im, 1, 7, 98, 8, $color4);
  17. $color = imagecolorallocate($im, 192, 255, 62);
  18. $color2 = imagecolorallocate($im, 179, 238, 58);
  19. $color3 = imagecolorallocate($im, 154, 205, 50);
  20. $color4 = imagecolorallocate($im, 105, 139, 34);
  21. if($perc>'0'){
  22. imagefilledrectangle ($im, 1, 1, $perc2, 2, $color);
  23. imagefilledrectangle ($im, 1, 3, $perc2, 4, $color2);
  24. imagefilledrectangle ($im, 1, 5, $perc2, 6, $color3);
  25. imagefilledrectangle ($im, 1, 7, $perc2, 8, $color4);}
  26. $text = imagecolorallocate($im, 0, 0, 0);
  27. ImageString($im, 0, 76, 1, "".$perc."%", $text);
  28. ImageGIF($im);
  29. ?>