325 |
richard |
1 |
<?php
|
|
|
2 |
/***************************************************************************
|
|
|
3 |
* Copyright (C) 2006 by phpSysInfo - A PHP System Information Script *
|
|
|
4 |
* http://phpsysinfo.sourceforge.net/ *
|
|
|
5 |
* *
|
|
|
6 |
* This program is free software; you can redistribute it and/or modify *
|
|
|
7 |
* it under the terms of the GNU General Public License as published by *
|
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
9 |
* (at your option) any later version. *
|
|
|
10 |
* *
|
|
|
11 |
* This program is distributed in the hope that it will be useful, *
|
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
14 |
* GNU General Public License for more details. *
|
|
|
15 |
* *
|
|
|
16 |
* You should have received a copy of the GNU General Public License *
|
|
|
17 |
* along with this program; if not, write to the *
|
|
|
18 |
* Free Software Foundation, Inc., *
|
|
|
19 |
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
20 |
***************************************************************************/
|
|
|
21 |
|
|
|
22 |
// $Id: indicator.php,v 1.4 2006/06/15 18:42:30 bigmichi1 Exp $
|
|
|
23 |
|
|
|
24 |
if ( ! defined( 'IN_PHPSYSINFO' ) ) {
|
|
|
25 |
die( "No Hacking" );
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
$start = $_GET['color1'];
|
|
|
29 |
$end = $_GET['color2'];
|
|
|
30 |
$percent = $_GET['percent'];
|
|
|
31 |
$height = $_GET['height'];
|
|
|
32 |
|
|
|
33 |
$width = 300;
|
|
|
34 |
|
|
|
35 |
sscanf( $start, "%2x%2x%2x", $rbase, $gbase, $bbase );
|
|
|
36 |
sscanf( $end, "%2x%2x%2x", $rend, $gend, $bend );
|
|
|
37 |
|
|
|
38 |
if( $rbase == $rend ) $rend = $rend - 1;
|
|
|
39 |
if( $gbase == $gend ) $gend = $gend - 1;
|
|
|
40 |
if( $bbase == $bend ) $bend = $bend - 1;
|
|
|
41 |
|
|
|
42 |
$rmod = ( $rend - $rbase ) / $width;
|
|
|
43 |
$gmod = ( $gend - $gbase ) / $width;
|
|
|
44 |
$bmod = ( $bend - $bbase ) / $width;
|
|
|
45 |
|
|
|
46 |
$image = imagecreatetruecolor( $width, $height );
|
|
|
47 |
imagefilledrectangle( $image, 0, 0, $width, $height, imagecolorallocate( $image, 255,255,255 ) );
|
|
|
48 |
|
|
|
49 |
$step = $width / 100;
|
|
|
50 |
|
|
|
51 |
for( $i = 0; $i < $percent * $step; $i = $i + $step + 1 ) {
|
|
|
52 |
$r = ( $rmod * $i ) + $rbase;
|
|
|
53 |
$g = ( $gmod * $i ) + $gbase;
|
|
|
54 |
$b = ( $bmod * $i ) + $bbase;
|
|
|
55 |
$color = imagecolorallocate( $image, $r, $g, $b );
|
|
|
56 |
imagefilledrectangle( $image, $i, 0, $i + $step, $height, $color );
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
imagerectangle( $image, 0, 0, $width - 1, $height - 1, imagecolorallocate( $image, 0, 0, 0 ) );
|
|
|
60 |
imagepng( $image );
|
|
|
61 |
imagedestroy( $image );
|
|
|
62 |
?>
|