package Memories::Photo;
+use Apache2::Upload;
use File::Basename;
use File::Copy;
use Archive::Any;
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);
$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;
sub _exif_info {
my $exifTool = new Image::ExifTool;
$exifTool->Options(Group0 => ['IPTC', 'EXIF', 'XMP', 'MakerNotes', 'Composite']);
- my $info = $exifTool->ImageInfo(shift->path);
+ my $info = $exifTool->ImageInfo(shift->path(0,0,1));
my $hash = {};
foreach my $tag ($exifTool->GetFoundTags('Group0')) {
next if $banned_tags{$tag};
}
sub path {
- my ($self, $is_url, $scale) = @_;
+ my ($self, $is_url, $scale, $raw) = @_;
my $path =
Memories->config->{$is_url eq "url" ? "data_store_external" : "data_store" };
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 ($scale or $is_url ne "url") {
+ if ($is_url ne "url" and ! -d $path) {mkpath($path) or die "Couldn't make path $path: $!";}
+ if ($scale or ($is_url ne "url" and !$raw)) {
$path .= $self->id.".jpg";
} else {
$path .= $self->id.".".($self->format||"jpg");