]> git.decadent.org.uk Git - memories.git/blobdiff - Memories/Photo.pm
Always used the "paged" template for multiple photo display. Fixes #19.
[memories.git] / Memories / Photo.pm
index 691a71415fe3dc210aad283cacc68ee733de6d0d..5ce8d956145728a8906e6f6418b78aba0893cd95 100644 (file)
@@ -1,5 +1,5 @@
 package Memories::Photo;
-use Apache2::Upload;
+#use Apache2::Upload;
 use File::Basename;
 use File::Copy;
 use Archive::Any;
@@ -7,6 +7,7 @@ use File::Temp qw(tempdir tmpnam);
 use File::Path qw(rmtree);
 use File::Find;
 use File::MMagic;
+use Image::Size qw(imgsize);
 use strict;
 use Carp qw(cluck confess);
 use base qw(Memories::DBI Maypole::Model::CDBI::Plain);
@@ -64,7 +65,7 @@ sub do_upload :Exported {
     }
     $r->objects(\@photos);
     if (@photos == 0) { $r->template("upload"); return  }
-    if (@photos > 1) { $r->template("list") } 
+    if (@photos > 1) { $r->template_args->{title} = "This upload"; $r->template("paged") } 
     else { $r->template("view"); }
     $r->message("Thanks for the upload!"); 
 }
@@ -83,7 +84,7 @@ sub quarantine :Exported {
     }
     $r->{session}{quarantined} = join ",", sort keys %q;
     if (!$r->{session}{quarantined}) {
-        $r->template("list");
+        $r->template_args->{title} = "This upload"; $r->template("paged");
         $r->objects([ map { $self->retrieve($_) } @quarantined ]);
     } else {
         $r->objects([ map { $self->retrieve($_) } sort keys %q ]);
@@ -127,10 +128,10 @@ sub upload_raw {
     $filename =~ /\.(.*)$/;
     my $format = $1;
     # Put the file in place
+    my $photo = $self->upload_jpeg($r, $jpg, $offered_name);
     $photo->format($format);
     copy($filename, 
          Memories->config->{data_store}."/".$photo->id.".".$format);
-    my $photo = $self->upload_jpeg($r, $jpg, $offered_name);
     return $photo;
 }
 
@@ -148,7 +149,7 @@ sub upload_jpeg {
        warn "Couldn't copy photo to ".$photo->path("file").": $!";
         $photo->delete(); die;
     }
-    my ($x, $y) = dim(image_info($photo->path));
+    my ($x, $y, undef) = imgsize($photo->path);
     $photo->x($x); $photo->y($y);
 
     # Rotate?
@@ -239,7 +240,6 @@ sub add_comment :Exported {
 }
 
 use Cache::MemoryCache;
-use Image::Info qw(dim image_info);
 use Image::ExifTool;
 my $cache = new Cache::MemoryCache( { 'namespace' => 'MemoriesInfo' });
 
@@ -452,7 +452,7 @@ sub tags_exif {
         map { split /\s*,\s*/, $md{$_}}
         grep {$md{$_} and $md{$_} =~/[^ 0:]/}
         (qw(Keywords Subject City State Location Country Province-State), 
-        'Transmission Reference', 'Intellectual Genre', 
+        'Intellectual Genre', 
         'Country-Primary Location Name'
         );
     return keys %tags;