summaryrefslogtreecommitdiff
path: root/modules/exif
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-07 01:18:31 +0000
committerBharat Mediratta <bharat@menalto.com>2009-05-07 01:18:31 +0000
commitfc6bdbbbc829b38c020c190e06e3fe5892bac1a0 (patch)
tree8b8bd0282cf341b8626bdf0be8e99af5f203d1b6 /modules/exif
parent934bc1e1f15405e7c4adb9d5bf59bad7680c5d79 (diff)
Grab photo capture date and captions from EXIF/IPTC data.
- Add a "captured" column to the items table. - Pull the DateTime EXIF field and put it into the captured column - Pull the Caption EXIF & IPTC fields and put them into the description field if there was not already a value there
Diffstat (limited to 'modules/exif')
-rw-r--r--modules/exif/helpers/exif.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php
index 25d9eadd..e185ac8a 100644
--- a/modules/exif/helpers/exif.php
+++ b/modules/exif/helpers/exif.php
@@ -43,8 +43,15 @@ class exif_Core {
}
$data[] = sprintf("(%d, '%s', '%s')", $item->id, $field, $db->escape_str($value));
}
+
+ if ($field == "DateTime") {
+ $item->captured = strtotime($value);
+ } else if ($field == "Caption" && !$item->description) {
+ $item->description = $value;
+ }
}
}
+
$size = getimagesize($item->file_path(), $info);
if (is_array($info) && !empty($info["APP13"])) {
$iptc = iptcparse($info["APP13"]);
@@ -59,6 +66,10 @@ class exif_Core {
$item->id, $keyword,
$db->escape_str($value));
}
+
+ if ($keyword == "Caption" && !$item->description) {
+ $item->description = $value;
+ }
}
}
@@ -70,6 +81,7 @@ class exif_Core {
$db->query($query);
}
}
+ $item->save();
$record = ORM::factory("exif_record")->where("item_id", $item->id)->find();
if (!$record->loaded) {