diff options
-rw-r--r-- | modules/tag/helpers/tag.php | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index 34ff16b6..16ed074d 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -97,7 +97,24 @@ class tag_Core { */ public static function on_photo_create() { $photo = Event::$data; - Kohana::log("debug", "tag::on_photo_create($photo->name)"); + $path = $photo->file_path(); + $tags = array(); + $size = getimagesize($photo->file_path(), $info); + if (is_array($info)) { + $iptc = iptcparse($info["APP13"]); + if (!empty($iptc["2#025"])) { + foreach($iptc["2#025"] as $tag) { + $tags[$tag]= 1; + } + } + } + + // @todo figure out how to read the keywords from xmp + + foreach(array_keys($tags) as $tag) { + self::add($photo, $tag); + } + return; } |