/[suikacvs]/okuchuu/piclist.ja.cgi
Suika

Contents of /okuchuu/piclist.ja.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations) (download)
Sun Aug 31 09:26:50 2003 UTC (20 years, 8 months ago) by wakaba
Branch: MAIN
Changes since 1.2: +5 -4 lines
Imported to CVS

1 wakaba 1.2 #!/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 wakaba 1.3 #use Suika::CGI;
24 wakaba 1.2 unless ($main::ENV{PATH_TRANSLATED}) {
25 wakaba 1.3 die;
26     #Suika::CGI::Error::die('open');
27 wakaba 1.2 }
28    
29     my $dir = $main::ENV{PATH_TRANSLATED};
30     $dir =~ s#/LIST$##;
31    
32 wakaba 1.3 opendir DIR, $dir or die; #Suika::CGI::Error::die('open', $dir);
33 wakaba 1.2 my @files = readdir(DIR);
34     close DIR;
35    
36     for (@files) {
37     undef $_ if /^\./;
38     if (/(.+)\.(?:jpe?g|png)/i) {
39     $_ = $1;
40     } else {undef $_}
41     }
42    
43 wakaba 1.3 my $title = '²èÁü°ìÍ÷';
44 wakaba 1.2
45     if (-e $dir.'/-TITLE') {
46     open TITLE, $dir.'/-TITLE';
47     ($title) = <TITLE>;
48     close TITLE;
49     }
50     print STDOUT "Content-Type: text/html; charset=euc-jp\n\n";
51    
52     #my $linkelement = '<link rel="stylesheet" href="/okuchuu/piclist-style" />'
53     my $linkelement = '<style type="text/css">img.s {width: 240px; height: 180px}</style>'
54     unless $Suika::CGI::param{realsize};
55     my $imgsattr = ' class="s"' unless $Suika::CGI::param{realsize};
56    
57     $| = '';
58     print <<EOH;
59     <html>
60     <head>
61     <title>${title}</title>
62     ${linkelement}
63     </head>
64     <body>
65     <h1>${title}</h1>
66     <div class="pictures">
67     EOH
68    
69    
70     for (sort @files) {
71     if ($_) {
72     print '<a href="'.$_.'">';
73     print '<img src="'.$_.'" alt="'.$_.'"'.$imgsattr.' />';
74     print "</a>\n";
75     }
76     }
77    
78     print <<EOH;
79     </div>
80    
81     <address>
82     [<a href="/">/</a>]
83     </address>
84     </body>
85     </html>
86     EOH
87    
88     1;
89    

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24