A lot of times I need to show a client some screenshots of webpages, or applications that I'm working on.
And usually, the client is very stupid when it comes to browsing a folder listing in a webpage (somehow, they don't know that they click on the image, view it, click back, and view another one.)
So I throw in this index.pl file in the folder and now they can happily see the picture AND the other links as well.
#!/usr/bin/perl -w use strict; use CGI qw/:standard/; print header; print start_html({-title=>'Image Lister', -bgcolor=>"#cccccc"}); my $me = CGI::url(); if (param('pic')) { my $pic = param('pic'); $pic =~ s/^\.+//; if ( -e "./$pic" ) { print img({src=>$pic, border=>1}), br, hr; } else { print "invalid pic."; } } opendir CURRENT, "." or die "What the? ($!)"; my @images = grep { /(png|jpg|gif)$/ } readdir CURRENT; close CURRENT; print br, a({-href=>"$me?pic=$_"}, $_) foreach @images; print end_html;
In reply to Image Lister by Chady
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |