From: Simon Cozens Date: Sat, 24 Mar 2007 15:12:56 +0000 (+0000) Subject: A few fixes found on Geoff's install. Check the Apache2 thing though! X-Git-Tag: 1.2+svn20070808~21 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=ee3791309bc60968e2ec00e5bc2d5158253b1dce;p=memories.git A few fixes found on Geoff's install. Check the Apache2 thing though! git-svn-id: http://svn.simon-cozens.org/memories/trunk@47 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 14d968b..3af95ce 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -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 { diff --git a/Memories/Tag.pm b/Memories/Tag.pm index 1140185..59df4df 100644 --- a/Memories/Tag.pm +++ b/Memories/Tag.pm @@ -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];