From 429b1202cdefc39eb1b83d5f9f634f3a959db873 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Sat, 24 Feb 2007 22:01:26 +0000 Subject: [PATCH] Write keywords back to file. Closes #3. git-svn-id: http://svn.simon-cozens.org/memories/trunk@39 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- Memories/Photo.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Memories/Photo.pm b/Memories/Photo.pm index 1eb0824..12016ef 100644 --- a/Memories/Photo.pm +++ b/Memories/Photo.pm @@ -372,22 +372,28 @@ sub edit_tags :Exported { my ($self, $r) = @_; my $photo = $r->objects->[0]; my %params = %{$r->params}; + my $exifTool = new Image::ExifTool; for (keys %params) { next unless /delete_(\d+)/; my $tagging = Memories::Tagging->retrieve($1) or next; next unless $tagging->photo->id == $photo->id; + $exifTool->SetNewValue(Keywords => $1, DelValue => 1); $tagging->delete; } + $exifTool->WriteInfo($photo->path); $photo->add_tags($params{newtags}); $r->template("view"); } sub add_tags { my ($photo, $tagstring) = @_; + my $exifTool = new Image::ExifTool; for my $tag (Tagtools->separate_tags($tagstring)) { - $photo->add_to_tags({tag => Memories::Tag->find_or_create({name =>$tag}) }) + $photo->add_to_tags({tag => Memories::Tag->find_or_create({name =>$tag}) }); + $exifTool->SetNewValue(Keywords => $tag, AddValue => 1); } + $exifTool->WriteInfo($photo->path); } # Work out some common properties from a set of potential photo metadata -- 2.39.5