grinder has asked for the wisdom of the Perl Monks concerning the following question:

What with the recent bout of photo displays from TPC, it occurred to me that I have piles of scanned photos from recent company parties, and I thought it would be fun to put them on my intranet, which is running Apache, although not mod_perl.

I searched for Slideshow on CPAN, and found Slideshow by Kevin Lenzo. This appears to be used in a classroom environment, and uses server-push to keep a series of clients looking at the same page. Then there's a group of modules for creating slideshows under Tk, which is also not what I want.

So I searched for perl web slideshow and found a large list of pointers to things that probably do what I want.

But rather than run the risk of wasting time downloading random code of unknown quality, I'd like to know whether any Perl Monks can give their seal of approval, or otherwise, to any Perl-based web slideshow packages that might be out there.

Note that I'm not even particularly fussed about doing this dynamically. I'll settle for a script that takes a list of files and spews out a series of static pages (although it would be nice to be able to do a meta/refresh, in order to have the pictures cycle by themselves).

Thanks for your pointers.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
  • Comment on Looking for a good Perl web slideshow script or module

Replies are listed 'Best First'.
•Re: Looking for a good Perl web slideshow script or module
by merlyn (Sage) on Jul 30, 2002 at 15:19 UTC
Re: Looking for a good Perl web slideshow script or module
by zentara (Cardinal) on Jul 30, 2002 at 17:03 UTC
    Here's a simple hack, it's setup to work with jpg's but you
    could modify it to accept any imagetype
    It uses nph-push to push a new jpg every 30 seconds
    I know it isn't a fancy module, but it works :-) I have the 2002
    swimsuit models going as a test. :-)
    #!/usr/bin/perl use warnings; use strict; $| = 1; my $boundary_string = "\n" . "--End" . "\n"; my $end_of_data = "\n" . "--End--" . "\n"; my $delay_time = 30; #seconds each is shown my $dir = 'images/'; #directory where images are my $pattern = '(.jpg)$'; #Filenames ending in .jpg opendir DIR, $dir or die "Cannot readdir $dir:$!\n"; my @files = grep /$pattern/,(readdir DIR); my @image_list= grep { $_ ne "." and $_ ne ".." } @files; closedir DIR; my $browser = $ENV{'HTTP_USER_AGENT'}; print<<EOH; Content-type: multipart/x-mixed-replace\;boundary=End EOH while(1){ for (my $loop=0; $loop < scalar (@image_list); $loop++) { &open_and_display_jpg ($image_list[$loop]); print $boundary_string; sleep ($delay_time); } } print $end_of_data; exit(0); sub open_and_display_jpg { my $file = $_[0]; if ( (open (FILE, "< $dir$file")) ) { my $content_length = (stat (FILE))[7]; print<<EOF; Content-type: image/jpg Content-length: $content_length EOF binmode FILE; print <FILE>; close (FILE); } else { #&return_error (500, "File Access Error", print "Cannot open graphic file $file!"; } }