diff options
-rw-r--r-- | core/helpers/core_installer.php | 1 | ||||
-rw-r--r-- | installer/install.sql | 3 | ||||
-rw-r--r-- | modules/exif/helpers/exif.php | 12 | ||||
-rw-r--r-- | modules/info/views/info_block.html.php | 6 |
4 files changed, 21 insertions, 1 deletions
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php index 8775cafe..a933762a 100644 --- a/core/helpers/core_installer.php +++ b/core/helpers/core_installer.php @@ -51,6 +51,7 @@ class core_installer { $db->query("CREATE TABLE {items} ( `album_cover_item_id` int(9) default NULL, + `captured` int(9) default NULL, `created` int(9) default NULL, `description` varchar(2048) default NULL, `height` int(9) default NULL, diff --git a/installer/install.sql b/installer/install.sql index 21863f8d..f312cc1d 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -114,6 +114,7 @@ SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; CREATE TABLE {items} ( `album_cover_item_id` int(9) default NULL, + `captured` int(9) default NULL, `created` int(9) default NULL, `description` varchar(2048) default NULL, `height` int(9) default NULL, @@ -148,7 +149,7 @@ CREATE TABLE {items} ( KEY `random` (`rand_key`) ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; SET character_set_client = @saved_cs_client; -INSERT INTO {items} VALUES (NULL,UNIX_TIMESTAMP(),'',NULL,1,1,1,NULL,NULL,NULL,0,NULL,NULL,1,2,NULL,NULL,1,'Gallery','album',UNIX_TIMESTAMP(),0,NULL,NULL,'weight','ASC',1,1,1); +INSERT INTO {items} VALUES (NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,1,NULL,NULL,NULL,0,NULL,NULL,1,2,NULL,NULL,1,'Gallery','album',UNIX_TIMESTAMP(),0,NULL,NULL,'weight','ASC',1,1,1); DROP TABLE IF EXISTS {items_tags}; SET @saved_cs_client = @@character_set_client; SET character_set_client = utf8; 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) { diff --git a/modules/info/views/info_block.html.php b/modules/info/views/info_block.html.php index 956cc23d..880d5d3e 100644 --- a/modules/info/views/info_block.html.php +++ b/modules/info/views/info_block.html.php @@ -17,6 +17,12 @@ <td><?= $item->name; ?></td> </tr> <? endif ?> + <? if ($item->captured): ?> + <tr> + <th><?= t("Captured:") ?></th> + <td><?= date("M j, Y H:i:s", $item->captured)?></td> + </tr> + <? endif ?> <? if ($item->owner): ?> <tr> <th><?= t("Owner:") ?></th> |