summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-11-28 18:04:59 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-11-28 18:04:59 +0000
commita7f6efa2f2bed248149fb2f5d3833301b92a2ecf (patch)
treecba188c1f6289ccf35fcfbaa8210fa2844de111a /modules
parent4d71975f37fe00efb19bebc5efd23f056165ba56 (diff)
When an image is uploaded (i.e. created) the tag module will now extract any iptc keywords and add them as image tags.
Diffstat (limited to 'modules')
-rw-r--r--modules/tag/helpers/tag.php19
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;
}