[ h o m e ]     [ c o d e ]

ProgressBar.pm - a module for making progress bars on the fly (note: this will only work with GD versions 1.19 and older - due to corporate greed, gif support has been removed from the GD library)

Here is an example cgi script that shows ProgressBar.pm in action

How does it look?

Like this:

or this:

or even this:

Synopsis:

use ProgressBar; 

$my_bar = new ProgressBar;
$my_bar->MakeBar(25,50,100,20);   

#syntax: $my_bar->Makebar(score, out-of-total,optional width, optional height) 
#this will return a binary mode stream (.gif) and appropriate content header
       
Here is an example of how to use this module as a real-time 
generated progress bar gif

------------------------------------------------------
Script:  (part one -- saved as /cgi-bin/progress.cgi)
------------------------------------------------------
use ProgressBar;
use CGI qw(:standard);

if(param())
{
  my $score = param("score");
  my $total = param("total");
  
  $foo = new ProgressBar;

  $foo->MakeBar($score,$total,"400","10");  #400 pixels wide, 10 pixels high..defaults to 150 x 10
}

-------------------------------------------------------
Image tag:  (part two - included in html file
that will reference this script as an image)
--------------------------------------------------------
Note:  

in this case, I am passing score and total as regular old
CGI name/value pairs ...your milage may vary

<img src="/cgi-bin/progress_example.cgi?score=60&total=100">

      

                 

Any and all feedback appreciated



© 1999 Steve McNabb - no stealin' stuff
© 2001 Steve McNabb - no stealin' stuff