WorxTech"; $graph_footer_space = 20; // 0=red, 1=green, 2=blue, 3=random $bar_colour = 0; session_start(); header("Content-type: image/jpg"); $amounts = $_SESSION['amounts']; asort($amounts); $pic_width = $bar_title_space+max($amounts)+($grid_space*1.5); $pic_height = ($bar_height+$bar_spacing+2)*sizeof($amounts)+20+$graph_title_space+$graph_footer_space; $pic = ImageCreate($pic_width+1,$pic_height+1); $white = ImageColorAllocate($pic,255,255,255); $grey = ImageColorAllocate($pic,200,200,200); $lt_grey = ImageColorAllocate($pic,210,210,210); $black = ImageColorAllocate($pic,0,0,0); ImageFilledRectangle($pic,0,0,$pic_width,$pic_height,$white); ImageString($pic,5,($pic_width/2)-(strlen($graph_title)*5),0,$graph_title,$black); ImageString($pic, 2,($pic_width/2)-(strlen($graph_footer)*3),$pic_height-$graph_footer_space, $graph_footer, $grey); for($x_axis=$bar_title_space ; ($x_axis-$bar_title_space)$amount) { ImageString($pic, 2, ($bar_title_space-(strlen($key)*6)), $y_axis, $key, $black); if($bar_colour==3) { $tempCol = ImageColorAllocate($pic,rand(50,200),rand(50,200),rand(50,200)); } else { $col -= $decrement; if($bar_colour==0) { $tempCol = ImageColorAllocate($pic,255,$col,$col); } else if($bar_colour==1) { $tempCol = ImageColorAllocate($pic,$col,200,$col); } else if($bar_colour==2) { $tempCol = ImageColorAllocate($pic,$col,$col,255); } } ImageFilledRectangle($pic,($bar_title_space+1),$y_axis,$amount+$bar_title_space,($y_axis+$bar_height),$tempCol); if(($amount)<15) { ImageString($pic, 2, ($amount+3)+$bar_title_space, $y_axis, $amount, $black); } else { ImageString($pic, 2, ($amount-(strlen($amount)*6))+$bar_title_space, $y_axis, $amount, $white); } $y_axis+=($bar_spacing+1)+$bar_height; } ImageJPG($pic); ImageDestroy($pic); ?>