|
I've written a perl subroutine (thanks, Paul Hartzog) which finds all the files
in a directory and returns some HTML code for thumbnails with links to those
images. Is there a way I can modify this code so it can work with a URL
instead of a directory? For example, so I can make thumbnail links to all the
images in my Brickshelf gallery...
Here is the subroutine ($imgdir is the directory to look in for images.)
-----------------------------------
sub thumbnailmenu {
my $thdr = $imgdir . "/thumb";
my $htmlcode = "";
opendir (INDIR,$imgdir);
chdir $imgdir;
foreach (sort readdir (INDIR) ) {
my $file = $_;
my $filesize = -s $file;
if (-f $file){
$htmlcode = $htmlcode . "<a href=\"$imgdir/" . $file . "\">";
$htmlcode = $htmlcode . "<img src=\"$thdr/" . $file .
"_thumb.jpg\" alt=\"[" . $filesize . " bytes]\">";
$htmlcode = $htmlcode . "</a>\n";
}
}
closedir (INDIR);
return $htmlcode;
}
-----------------------------------
Thanks in advance!
--Bram
Bram Lambrecht
bram@cwru.edu
http://home.cwru.edu/~bxl34/
|
|
Message has 1 Reply: | | Re: Thumbnail menu CGI script
|
| (...) no simple way - since the script assumes you have local access to the directory... and since there is no real way of you knowing what files are in a directory on the webserver, unless it allows you to list them. the only thing you can do is (...) (24 years ago, 18-Jan-01, to lugnet.off-topic.geek)
|
11 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|