mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-04-19 12:09:16 -04:00
When an image is uploaded (i.e. created) the tag module will now extract any iptc keywords and add them as image tags.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user