]> git.decadent.org.uk Git - memories.git/commitdiff
A few fixes found on Geoff's install. Check the Apache2 thing though!
authorSimon Cozens <simon@simon-cozens.org>
Sat, 24 Mar 2007 15:12:56 +0000 (15:12 +0000)
committerSimon Cozens <simon@simon-cozens.org>
Sat, 24 Mar 2007 15:12:56 +0000 (15:12 +0000)
git-svn-id: http://svn.simon-cozens.org/memories/trunk@47 041978f6-d955-411f-a9d7-1d8545c9c3c7

Memories/Photo.pm
Memories/Tag.pm

index 14d968b66fa76ff0ae44362c28632a8ac3df920c..3af95ce787c57e87ac73b4509b3601af46b63e04 100644 (file)
@@ -1,4 +1,5 @@
 package Memories::Photo;
+use Apache2::Upload;
 use File::Basename;
 use File::Copy;
 use Archive::Any;
@@ -145,7 +146,8 @@ sub upload_jpeg {
         rated => 0,
     });
     if (!copy($filename, $photo->path("file"))) {
-        $photo->delete(); die "Couldn't copy photo: $!";
+       warn "Couldn't copy photo to ".$photo->path("file").": $!";
+        $photo->delete(); die;
     }
     my ($x, $y) = dim(image_info($photo->path));
     $photo->x($x); $photo->y($y);
@@ -159,8 +161,10 @@ sub upload_jpeg {
     $photo->make_thumb;
     my $tags = $r->{params}{tags}.join " ", map { qq{"$_"} } $photo->tags_exif;
     $photo->add_tags($tags);
+warn "D";
     $photo->add_to_imageseek_library;
     Memories->zap_cache();
+warn "E";
 
     # Add system tags here
     my $tag = "date:".$photo->shot->ymd;
@@ -346,7 +350,7 @@ sub path {
     if ($scale) { $path .= "$scale/" }
     # Make dir if it doesn't exist, save trouble later
     use File::Path;
-    if ($is_url ne "url") {mkpath($path);}
+    if ($is_url ne "url" and ! -d $path) {mkpath($path) or die "Couldn't make path $path: $!";}
     if ($scale or $is_url ne "url") { 
         $path .= $self->id.".jpg";
     } else {
index 1140185a307e45e07b328e919a463c9d4120c802..59df4df80e0812fd71849ed3222271ea5321e2bc 100644 (file)
@@ -28,7 +28,7 @@ sub view :Exported {
         $sth->finish;
         $r->{template_args}{tags} = \@tags;
     } else {
-        if (!$r->objects) {
+        if (!@{$r->objects||[]}) {
             $tag = $tags[0];
         } else {
             $tag = $r->objects->[0];