Mercurial > hg > mgallery
changeset 339:04868ed6aab2
Extract image title from XMP tags.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 27 Aug 2023 00:15:09 +0300 |
parents | 83416b104442 |
children | 67e5bf30ee9b |
files | mgtool.php |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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;