comparison mgtool.php @ 283:1bcaab2d3e6a

Define named constants for $galExifConversions array fields.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 17 May 2019 02:05:01 +0300
parents d458ec179c87
children 403f2e1e5e79
comparison
equal deleted inserted replaced
282:d458ec179c87 283:1bcaab2d3e6a
29 29
30 // 30 //
31 // Array for specifying what will be copied and converted 31 // Array for specifying what will be copied and converted
32 // from the image file's EXIF information tag(s). 32 // from the image file's EXIF information tag(s).
33 // 33 //
34 define("GEC_TYPE" , 0);
35 define("GEC_NAME" , 1);
36 define("GEC_FIELDS" , 2);
37
34 $galExifConversions = 38 $galExifConversions =
35 [ 39 [
36 [ MG_STR, "caption" , "ImageDescription" ], 40 [ MG_STR, "caption" , "ImageDescription" ],
37 [ MG_STR, "copyright" , "Copyright" ], 41 [ MG_STR, "copyright" , "Copyright" ],
38 [ MG_STR, "model" , "Model" ], 42 [ MG_STR, "model" , "Model" ],
850 if (($updFlags & GUPD_EXIF_INFO) && 854 if (($updFlags & GUPD_EXIF_INFO) &&
851 ($xmpStr = mgReadXMPData($efilename)) !== FALSE && 855 ($xmpStr = mgReadXMPData($efilename)) !== FALSE &&
852 ($xmp = mgParseXMPData($xmpStr)) !== FALSE) 856 ($xmp = mgParseXMPData($xmpStr)) !== FALSE)
853 { 857 {
854 foreach ($galExifConversions as $conv) 858 foreach ($galExifConversions as $conv)
855 mgCopyEntryData($edata, $xmp, $conv[0], $conv[1], $conv[2]); 859 mgCopyEntryData($edata, $xmp, $conv[GEC_TYPE], $conv[GEC_NAME], $conv[GEC_FIELDS]);
856 } 860 }
857 861
858 // Check for EXIF info 862 // Check for EXIF info
859 if (($updFlags & GUPD_EXIF_INFO) && 863 if (($updFlags & GUPD_EXIF_INFO) &&
860 ($exif = @exif_read_data($efilename)) !== FALSE) 864 ($exif = @exif_read_data($efilename)) !== FALSE)
861 { 865 {
862 echo "%"; 866 echo "%";
863 foreach ($galExifConversions as $conv) 867 foreach ($galExifConversions as $conv)
864 mgCopyEntryData($edata, $exif, $conv[0], $conv[1], $conv[2]); 868 mgCopyEntryData($edata, $exif, $conv[GEC_TYPE], $conv[GEC_NAME], $conv[GEC_FIELDS]);
865 } 869 }
866 else 870 else
867 { 871 {
868 // Copy old data that is not yet in new 872 // Copy old data that is not yet in new
869 echo "*"; 873 echo "*";