Bandwidth / Disk space graphs

ProWebUK

Verified User
Joined
Jun 9, 2003
Messages
2,326
Location
UK
Im assuming no one has developed anything of the such yet ;)

will try and get a script setup today with some instructions for you :D

Chris
 
Speaking to spinnahost Mark nad he handed the code to me straight away!

so thanks to SH-Mark for this :cool:

in any files of your skin put the following code:

between the <head> / </head> tags

Code:
<script language="JavaScript">  
function percent(used, total) {  
   return used/total*100;  
}  
  
function graph(percent, image, height) {  
   document.write('<img src="'+image+'" height="'+height+'" width="'+percent+'%" />');  
}  
  
// to call: graph(percent(|USERBANDWIDTH|, |USERBANDWIDTHMAX|), IMG_GRAPHPIXEL, 10);  
</script>

where you want to display the graphs

Code:
<script>  
graph(percent(|USERBANDWIDTH|, |USERBANDWIDTHMAX|), IMG_GRAPHPIXEL, 25); 
</script>

In file_user.conf add the following line:

Code:
IMG_GRAPHPIXEL=/images/graphpixel.gif
upload a 1x1 (or if you want bigger.. have bigger ;) ) so the image, "graphpixel.gif" is in the images directory.

Any problems post here ;)

Chris
 
Last edited:
note

that last number in the call is how high you want it, the IMG_GRAPHPIXEL should be a 1px by 1px image that you define in the files_user.conf

its all tested, and all works
 
Back
Top