# HG changeset patch # User Matti Hamalainen # Date 1693084509 -10800 # Node ID 04868ed6aab20232eb2cde036451ed0aa5208d9f # Parent 83416b104442d6e6874cdd13b91d5af45d3ef2c5 Extract image title from XMP tags. diff -r 83416b104442 -r 04868ed6aab2 mgtool.php --- a/mgtool.php Sun Aug 27 00:14:51 2023 +0300 +++ b/mgtool.php Sun Aug 27 00:15:09 2023 +0300 @@ -39,6 +39,7 @@ $galExifConversions = [ [ MG_STR, "caption" , "ImageDescription" , TRUE ], + [ MG_STR, "title" , "ImageTitle" , TRUE ], [ MG_STR, "copyright" , "Copyright" , FALSE ], [ MG_STR, "model" , "Model" , FALSE ], [ MG_STR, "lensmodel" , "UndefinedTag:0xA434" , FALSE ], @@ -494,8 +495,12 @@ // What EXIF does NOT have are the keywords .. so grab them. if (($xres = $xmpOb->xpath("RDF/Description/subject/li")) !== FALSE) + $xmpData["keywords"] = array_map(function($xkw) { return (string) $xkw; }, $xres); + + // Get image title + if (($xres = $xmpOb->xpath("RDF/Description/title/li")) !== FALSE) { - $xmpData["keywords"] = array_map(function($xkw) { return (string) $xkw; }, $xres); + $xmpData["title"] = implode(" ", array_map(function($xe) { return (string) $xe; }, $xres)); } return $xmpData;