]> git.decadent.org.uk Git - memories.git/blobdiff - Memories/Photo.pm
Ajaxify the main tabs
[memories.git] / Memories / Photo.pm
index 4279dc97c0eb4c622ec365390d97dd424938ae3e..f2999c3c110541b6f85cbb7043273e42df5ba4da 100644 (file)
@@ -54,6 +54,7 @@ sub do_upload :Exported {
     }
 
     $photo->make_thumb;
+    $r->{params}{tags} ||= join " ", map { qq{"$_"} } $photo->tags_exif;
     $photo->add_tags($r->{params}{tags});
     $photo->add_to_imageseek_library;
     Memories->zap_cache();
@@ -92,6 +93,10 @@ sub view :Exported {
     }
 }
 sub upload :Exported {}
+sub exif :Exported {}
+sub comment :Exported {}
+sub tagedit :Exported {}
+sub similar :Exported {}
 
 use Class::DBI::Plugin::Pager;
 use Class::DBI::Plugin::AbstractCount;
@@ -318,4 +323,19 @@ sub description {
 sub title_exif { shift->_grovel_metadata( 'Headline', 'Title'); }
 sub license { shift->_grovel_metadata( 'Rights Usage Terms', 'Usage Terms' ) }
 sub copyright { shift->_grovel_metadata( 'Rights', 'Copyright', 'Copyright Notice') }
+
+# This one's slightly different since we want everything we can get...
+sub tags_exif {
+    my $self = shift;
+    my %md = map {%$_} values %{$self->exif_info};
+    my %tags = 
+        map { s/\s+/-/g; lc $_ => 1  }
+        map { split /\s*,\s*/, $md{$_}}
+        grep {$md{$_} and $md{$_} =~/[^ 0:]/}
+        (qw(Keywords Subject City State Location Country Province-State), 
+        'Transmission Reference', 'Intellectual Genre', 
+        'Country-Primary Location Name'
+        );
+    return keys %tags;
+}
 1;