mason/dhandler: Build the image a little earlier.
[tgal] / mason / dhandler
index 24b5026..aca88bb 100755 (executable)
@@ -145,11 +145,12 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 <%perl>
        my ($dir, $base, $ext) = split_path $path;
        my $real = join_paths $IMGROOT, $path;
+       my $img = TrivGal::Image->new($path);
        my $url = join_paths $IMGURL, $path;
        my $realdir = join_paths $IMGROOT, $dir;
        my $urldir = join_paths $SCRIPTURL, $dir;
        my ($dd, $ff, $ii) = listdir $realdir;
-       my $vw = TrivGal::Image->new($path)->scale("view");
+       my $vw = $img->scale("view");
 
        my $fi = undef;
        FILE: for (my $i = 0; $i < @$ff; $i++)
@@ -290,8 +291,7 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
     terms of the
     <a rel=license href="https://www.gnu.org/licenses/agpl-3.0.en.html">GNU Affero
     General Public License version 3</a>.
-    Browse or download
-    the <a href="https://git.distorted.org.uk/~mdw/tgal/">source code</a>.
+    Browse or download the <a href="<% $SRCURL %>">source code</a>.
   </div>
 % my $user =
 %   find_covering_file $IMGROOT, $path, ".tgal-footer.html";
@@ -309,7 +309,6 @@ Failed to find &lsquo;<% $path |h %>&rsquo;.
 %###-------------------------------------------------------------------------
 <%once>
        use autodie;
-use Data::Dumper;
        use File::stat;
 
        use TrivGal;
@@ -325,7 +324,8 @@ use Data::Dumper;
        elsif (-d $st) { $comp = ".contact"; }
        elsif (-f $st) { $comp = ".image"; }
        else { $comp = ".not-found"; }
-       $m->comp($comp, path => $path);
+        $r->header_out("X-AGPL-Source" => $SRCURL);
+       $m->comp($comp, path => $path, %ARGS);
 </%init>
 %
 %###----- That's all, folks -------------------------------------------------