| 1 |
wakaba |
1.1 |
#!/usr/local/bin/perl
|
| 2 |
|
|
|
| 3 |
|
|
=pod
|
| 4 |
|
|
|
| 5 |
|
|
Make list of pictures in directory.
|
| 6 |
|
|
|
| 7 |
|
|
Copyright: Public Domain.
|
| 8 |
|
|
|
| 9 |
|
|
Change:
|
| 10 |
|
|
|
| 11 |
|
|
2001-06-25 wakaba <wakaba@61.201.226.127>
|
| 12 |
|
|
|
| 13 |
|
|
- In default, images are sized by stylesheet. When ?realsize=1,
|
| 14 |
|
|
images are not specified its size.
|
| 15 |
|
|
- Images are linked to itself.
|
| 16 |
|
|
|
| 17 |
|
|
2001-05-17 wakaba
|
| 18 |
|
|
|
| 19 |
|
|
- New File.
|
| 20 |
|
|
|
| 21 |
|
|
=cut
|
| 22 |
|
|
|
| 23 |
|
|
use Suika::CGI;
|
| 24 |
|
|
unless ($main::ENV{PATH_TRANSLATED}) {
|
| 25 |
|
|
Suika::CGI::Error::die('open');
|
| 26 |
|
|
}
|
| 27 |
|
|
|
| 28 |
|
|
my $dir = $main::ENV{PATH_TRANSLATED};
|
| 29 |
|
|
$dir =~ s#/LIST$##;
|
| 30 |
|
|
|
| 31 |
|
|
opendir DIR, $dir or Suika::CGI::Error::die('open', $dir);
|
| 32 |
|
|
my @files = readdir(DIR);
|
| 33 |
|
|
close DIR;
|
| 34 |
|
|
|
| 35 |
|
|
for (@files) {
|
| 36 |
|
|
undef $_ if /^\./;
|
| 37 |
|
|
if (/(.+)\.(?:jpe?g|png)/i) {
|
| 38 |
|
|
$_ = $1;
|
| 39 |
|
|
} else {undef $_}
|
| 40 |
|
|
}
|
| 41 |
|
|
|
| 42 |
|
|
my $title = '写真一覧';
|
| 43 |
|
|
|
| 44 |
|
|
if (-e $dir.'/-TITLE') {
|
| 45 |
|
|
open TITLE, $dir.'/-TITLE';
|
| 46 |
|
|
($title) = <TITLE>;
|
| 47 |
|
|
close TITLE;
|
| 48 |
|
|
}
|
| 49 |
|
|
print STDOUT "Content-Type: text/html; charset=euc-jp\n\n";
|
| 50 |
|
|
|
| 51 |
|
|
#my $linkelement = '<link rel="stylesheet" href="/okuchuu/piclist-style" />'
|
| 52 |
|
|
my $linkelement = '<style type="text/css">img.s {width: 240px; height: 180px}</style>'
|
| 53 |
|
|
unless $Suika::CGI::param{realsize};
|
| 54 |
|
|
my $imgsattr = ' class="s"' unless $Suika::CGI::param{realsize};
|
| 55 |
|
|
|
| 56 |
|
|
$| = '';
|
| 57 |
|
|
print <<EOH;
|
| 58 |
|
|
<html>
|
| 59 |
|
|
<head>
|
| 60 |
|
|
<title>${title}</title>
|
| 61 |
|
|
${linkelement}
|
| 62 |
|
|
</head>
|
| 63 |
|
|
<body>
|
| 64 |
|
|
<h1>${title}</h1>
|
| 65 |
|
|
<div class="pictures">
|
| 66 |
|
|
EOH
|
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
for (sort @files) {
|
| 70 |
|
|
if ($_) {
|
| 71 |
|
|
print '<a href="'.$_.'">';
|
| 72 |
|
|
print '<img src="'.$_.'" alt="'.$_.'"'.$imgsattr.' />';
|
| 73 |
|
|
print "</a>\n";
|
| 74 |
|
|
}
|
| 75 |
|
|
}
|
| 76 |
|
|
|
| 77 |
|
|
print <<EOH;
|
| 78 |
|
|
</div>
|
| 79 |
|
|
|
| 80 |
|
|
<address>
|
| 81 |
|
|
[<a href="/">/</a>]
|
| 82 |
|
|
[<a href="/okuchuu/">伝説(謎)の「おくちゅ。」</a>]
|
| 83 |
|
|
</address>
|
| 84 |
|
|
</body>
|
| 85 |
|
|
</html>
|
| 86 |
|
|
EOH
|
| 87 |
|
|
|
| 88 |
|
|
1;
|
| 89 |
|
|
|