Mercurial > hg > mgallery
comparison mgtool.php @ 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 |
comparison
equal
deleted
inserted
replaced
338:83416b104442 | 339:04868ed6aab2 |
---|---|
37 define("GEC_IS_UNIQUE" , 3); | 37 define("GEC_IS_UNIQUE" , 3); |
38 | 38 |
39 $galExifConversions = | 39 $galExifConversions = |
40 [ | 40 [ |
41 [ MG_STR, "caption" , "ImageDescription" , TRUE ], | 41 [ MG_STR, "caption" , "ImageDescription" , TRUE ], |
42 [ MG_STR, "title" , "ImageTitle" , TRUE ], | |
42 [ MG_STR, "copyright" , "Copyright" , FALSE ], | 43 [ MG_STR, "copyright" , "Copyright" , FALSE ], |
43 [ MG_STR, "model" , "Model" , FALSE ], | 44 [ MG_STR, "model" , "Model" , FALSE ], |
44 [ MG_STR, "lensmodel" , "UndefinedTag:0xA434" , FALSE ], | 45 [ MG_STR, "lensmodel" , "UndefinedTag:0xA434" , FALSE ], |
45 [ MG_INT, "width" , ["COMPUTED", "Width"] , TRUE ], | 46 [ MG_INT, "width" , ["COMPUTED", "Width"] , TRUE ], |
46 [ MG_INT, "height" , ["COMPUTED", "Height"] , TRUE ], | 47 [ MG_INT, "height" , ["COMPUTED", "Height"] , TRUE ], |
492 $xmpData["description"] = implode(" ", array_map(function($xe) { return (string) $xe; }, $xres)); | 493 $xmpData["description"] = implode(" ", array_map(function($xe) { return (string) $xe; }, $xres)); |
493 */ | 494 */ |
494 | 495 |
495 // What EXIF does NOT have are the keywords .. so grab them. | 496 // What EXIF does NOT have are the keywords .. so grab them. |
496 if (($xres = $xmpOb->xpath("RDF/Description/subject/li")) !== FALSE) | 497 if (($xres = $xmpOb->xpath("RDF/Description/subject/li")) !== FALSE) |
497 { | |
498 $xmpData["keywords"] = array_map(function($xkw) { return (string) $xkw; }, $xres); | 498 $xmpData["keywords"] = array_map(function($xkw) { return (string) $xkw; }, $xres); |
499 | |
500 // Get image title | |
501 if (($xres = $xmpOb->xpath("RDF/Description/title/li")) !== FALSE) | |
502 { | |
503 $xmpData["title"] = implode(" ", array_map(function($xe) { return (string) $xe; }, $xres)); | |
499 } | 504 } |
500 | 505 |
501 return $xmpData; | 506 return $xmpData; |
502 } | 507 } |
503 | 508 |