X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=Memories%2FPhoto.pm;h=a92280782c721af1d6e04987d5861d9981d9d7dd;hb=fab613118bc37d7a6f48b60e1b4ff0e7ab0041ea;hp=4945dd8fc719510f045da426022b9692882dc649;hpb=d6ac351d3aa425d6701da07e736aa2490b09468b;p=memories.git diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 4945dd8..a922807 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -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); @@ -124,13 +125,13 @@ sub upload_raw { my ($self, $r, $filename, $offered_name) = @_; my $jpg = tmpnam().".jpg"; system("dcraw -c $filename | convert - $jpg"); - my $photo = $self->upload_jpeg($r, $jpg, $offered_name); $filename =~ /\.(.*)$/; my $format = $1; - $photo->format($format); # Put the file in place + $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;