#!/usr/bin/perl #cycleimages.pl # (C) 1995 Brian Valente, all rights reserved # You may freely copy this script, so long as this copyright statement is # intact # a simple little server push script in perl require ("ci_config.pl"); #Misc Constants $TRUE=1; $FALSE=0; #Server push constants $HEADER="Content-type: multipart/x-mixed-replace;boundary=ThisRandomString\n"; $RANDOMSTRING="\n--ThisRandomString\n"; $ENDSTRING="\n--ThisRandomString--\n"; $CTSTRING="Content-type: image/gif\n\n"; $Continue=$TRUE; $Counter=0; $MaxImages=@IMAGES; ###################################### print(STDOUT $HEADER); print (STDOUT $RANDOMSTRING); while ($Continue){ sleep($SLEEP_TIME); print (STDOUT $CTSTRING); if (open(FHandle, "$IMAGE_PATH$DELIM$IMAGES[$Counter]")){ while (){ print; } print (STDOUT $RANDOMSTRING); close(FHandle); # reset counter to 1 if at max # images, otherwise increment counter if (($Counter+1) < $MaxImages){ $Counter=$Counter+1; } else { #$Counter=0; # reset counter $Continue=$FALSE; } # $Counter = (1) ? ($Counter >= ($MaxImages-1)) : $Counter++; } else { $Continue=$FALSE; } }