$startdir="/www/intranet/images"; push(@dirs,$startdir); foreach $dir (@dirs) { opendir(DIR,"$dir") || die "opendir $dir failed"; @list = grep(!/^\.\.?$/,readdir(DIR)); closedir(DIR); foreach $item (@list) { $fullname = $dir."/".$item; # add the directory name to th +e file name if (-d $fullname) { push(@dirs,$fullname); print "$item<br>"; } } } print "Content-type:text/html\n\n"; &parse; print qq| <html> <head> <link rel="stylesheet" type="text/css" href="/include/style.css"/> </head> <body> <p> <form action=/cgi-bin/images.cgi method=post> <select name=pic> <option value=$FORM{'pic'} selected>$FORM{'pic'} |; foreach $thisdir (@dirs) { print qq| <option value="$thisdir">$thisdir |; } print qq| <input type=submit value="Go!"> </form> </html> |; opendir(DIR,"$FORM{'pic'}") || die "opendir $dir failed"; @piclist = grep(!/^\.\.?$/,readdir(DIR)); closedir(DIR); print "<table cellpadding=10 cellspacing=0 width=100%>"; while (@piclist) { my @row_entries= splice (@piclist, 0, 5); print "<tr>"; for (@row_entries) { print "<td>"; $FORM{'pic'} =~ s/\/www\/intranet//; print qq| <img src=$FORM{'pic'}/$_><br>$_<p> |; print "</td>"; } print "</tr>"; } sub parse { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } }
In reply to simple image gallery generated by server image directory
by monkscafe
in thread simple column/row counter
by monkscafe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |