X-Git-Url: https://git.distorted.org.uk/~mdw/tgal/blobdiff_plain/1408b7a293e5a35d99744aaa51192eab972a95a1..84ffdea7357ad52e4ad8df5ad57b90c7c097252b:/mason/dhandler
diff --git a/mason/dhandler b/mason/dhandler
index 813e637..c6f0f33 100755
--- a/mason/dhandler
+++ b/mason/dhandler
@@ -35,8 +35,8 @@ of the GNU Affero General Public License.
-
- ">
+
+ ">
<% $head %>\
<% $title %>
@@ -67,9 +67,9 @@ Failed to find ‘<% $path |h %>’.
%###-------------------------------------------------------------------------
<%def .contact>\
<%perl>
- unless ($r->path_info =~ m!/$!) {
- $m->redirect(join_paths($SCRIPTURL, $path) . "/");
- }
+ unless ($r->path_info =~ m!/$!)
+ { $m->redirect(join_paths($SCRIPTURL, $path) . "/"); }
+
my $real = join_paths $IMGROOT, $path;
my $url = join_paths $SCRIPTURL, $path;
my ($dd, $ff, $ii) = listdir $real;
@@ -83,20 +83,45 @@ Failed to find ‘<% $path |h %>’.
}
(my $nosl = $path) =~ s!/$!!;
+ my @size = ("smallthumb", "medthumb", "bigthumb");
my %tn;
- for my $f (@$ff)
- { $tn{$f} = TrivGal::Image->new($path . $f->name); }
+ my %count;
+ for my $f (@$ff) {
+ my $img = TrivGal::Image->new($path . $f->name);
+ for my $size (@size) { $tn{$f}{$size} = $img->scale($size); }
+ }
for my $d (@$dd) {
- my ($ddd, $fff, $iii) = listdir $real . "/" . $d->name;
- $tn{$d} = $iii ?
- TrivGal::Image->new(join_paths $path, $d->name, $iii->name) :
- undef;
+ my $p = join_paths $path, $d->name;
+ my ($ddd, $fff, $iii);
+ ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;
+
+ my $count = "";
+ $count .= scalar(@$ddd) . "/" if @$ddd;
+ $count .= scalar(@$fff) if @$fff;
+ $count{$d} = $count;
+
+ DIR: for (;;) {
+ if (defined $iii) {
+ my $index = join_paths $p, $iii->name;
+ my $img = TrivGal::Image->new($index);
+ for my $size (@size) { $tn{$d}{$size} = $img->scale($size); }
+ last DIR;
+ }
+ if (!@$ddd) { $tn{$d} = undef; last DIR; }
+ $p = join_paths $p, $ddd->[0]->name;
+ ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p;
+ }
}
%perl>
%
-<&| .html, title => "Folder " . $m->interp->apply_escapes($nosl || "[top]", "h"),
+<&| .html, title =>
+ "Folder " . $m->interp->apply_escapes($nosl || "[top]", "h"),
head => $links &>
-<& .breadcrumbs, what => "Folder", path => $path &>
+<&| .breadcrumbs, what => "Folder", path => $path &>
+