--- okuchuu/piclist.ja.cgi 2005/03/11 11:51:48 1.6 +++ okuchuu/piclist.ja.cgi 2005/03/26 04:51:41 1.7 @@ -54,8 +54,17 @@ } } +my $dirpath = escape $ENV{REQUEST_URI}; +$dirpath =~ s/\#.*$//; +$dirpath =~ s/\?.*$//; +$dirpath =~ s/,[^,]*$//g; unless (-d $dir) { -# $dir =~ s#/+[^/]+$##; + $dir =~ s#/+[^/]+$##; + $dirpath =~ s#/[^/]+$#/#; + $dirpath ||= '/'; +} else { + $dirpath =~ s#/LIST$##; + $dirpath =~ s#/?$#/#; } opendir DIR, $dir or die "$dir: $!"; @@ -76,11 +85,25 @@ return 0; } +sub preview_uri ($) { + my $original_file_name = shift; + $original_file_name =~ s/\..*$//; + my $file_name = $original_file_name; + if ($file_name =~ /-small$/) { + return $file_name; + } else { + $file_name =~ s/-large$//; + if (has_file $file_name . '-small') { + return $file_name . '-small'; + } elsif (has_file $file_name) { + return $file_name; + } else { + return $original_file_name; + } + } +} + my $title = '画像一覧'; -my $dirpath = escape $ENV{REQUEST_URI}; -$dirpath =~ s/\?.*$//; -$dirpath =~ s#/[^/]+$##; -$dirpath ||= '/'; print STDOUT "Content-Type: text/html; charset=euc-jp\n\n"; @@ -91,6 +114,7 @@
+