getConfigVar ('rtwidth_0'), 1 => getConfigVar ('rtwidth_1'), 2 => getConfigVar ('rtwidth_2') ); $rtdepth = 9; $offset[0] = 3; $offset[1] = 3 + $rtwidth[0]; $offset[2] = 3 + $rtwidth[0] + $rtwidth[1]; $totalheight = 3 + 3 + $rackData['height'] * 2; $totalwidth = $offset[2] + $rtwidth[2] + 3; $img = @imagecreatetruecolor ($totalwidth, $totalheight) or die("Cannot Initialize new GD image stream"); // cache our palette as well $color = array(); foreach (array ('F', 'A', 'U', 'T', 'Th', 'Tw', 'Thw') as $statecode) $color[$statecode] = colorFromHex ($img, getConfigVar ('color_' . $statecode)); $color['black'] = colorFromHex ($img, '000000'); $color['gray'] = colorFromHex ($img, 'c0c0c0'); imagerectangle ($img, 0, 0, $totalwidth - 1, $totalheight - 1, $color['black']); imagerectangle ($img, 1, 1, $totalwidth - 2, $totalheight - 2, $color['gray']); imagerectangle ($img, 2, 2, $totalwidth - 3, $totalheight - 3, $color['black']); for ($unit_no = 1; $unit_no <= $rackData['height']; $unit_no++) { for ($locidx = 0; $locidx < 3; $locidx++) { $colorcode = $rackData[$unit_no][$locidx]['state']; if (isset ($rackData[$unit_no][$locidx]['hl'])) $colorcode = $colorcode . $rackData[$unit_no][$locidx]['hl']; imagerectangle ( $img, $offset[$locidx], 3 + ($rackData['height'] - $unit_no) * 2, $offset[$locidx] + $rtwidth[$locidx] - 1, 3 + ($rackData['height'] - $unit_no) * 2 + 1, $color[$colorcode] ); } } imagepng ($img); imagedestroy ($img); } function renderProgressBarImage ($done) { $img = @imagecreatetruecolor (100, 10); $color['T'] = colorFromHex ($img, getConfigVar ('color_T')); $color['F'] = colorFromHex ($img, getConfigVar ('color_F')); imagefilledrectangle ($img, 0, 0, $done, 10, $color['T']); imagefilledrectangle ($img, $done, 0, 100, 10, $color['F']); header("Content-type: image/png"); imagepng ($img); imagedestroy ($img); } ?>