Changeset 619 for trunk/tools/create_listing_file.php
- Timestamp:
- Nov 24, 2004, 10:43:33 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/create_listing_file.php
r606 r619 54 54 $conf['use_iptc'] = false; 55 55 56 // use_iptc_mapping : in which IPTC fields will PhpWebGallery find image 57 // information ? This setting is used during metadata synchronisation. It 58 // associates a phpwebgallery_images column name to a IPTC key 59 $conf['use_iptc_mapping'] = array( 60 'keywords' => '2#025', 61 'date_creation' => '2#055', 62 'author' => '2#122', 63 'name' => '2#005', 64 'comment' => '2#120' 65 ); 66 56 67 // +-----------------------------------------------------------------------+ 57 68 // | functions | … … 83 94 foreach (array_keys($rmap) as $iptc_key) 84 95 { 85 if (isset($iptc[$iptc_key][0]) and $value = $iptc[$iptc_key][0]) 86 { 87 // strip leading zeros (weird Kodak Scanner software) 88 while ($value[0] == chr(0)) 96 if (isset($iptc[$iptc_key][0])) 97 { 98 if ($iptc_key == '2#025') 89 99 { 90 $value = substr($value, 1); 100 $value = implode(',', 101 array_map('clean_iptc_value',$iptc[$iptc_key])); 91 102 } 92 // remove binary nulls 93 $value = str_replace(chr(0x00), ' ', $value); 94 103 else 104 { 105 $value = clean_iptc_value($iptc[$iptc_key][0]); 106 } 107 95 108 foreach (array_keys($map, $iptc_key) as $pwg_key) 96 109 { … … 104 117 } 105 118 119 /** 120 * return a cleaned IPTC value 121 * 122 * @param string value 123 * @return string 124 */ 125 function clean_iptc_value($value) 126 { 127 // strip leading zeros (weird Kodak Scanner software) 128 while ($value[0] == chr(0)) 129 { 130 $value = substr($value, 1); 131 } 132 // remove binary nulls 133 $value = str_replace(chr(0x00), ' ', $value); 134 135 return $value; 136 } 137 106 138 function get_sync_iptc_data($file) 107 139 { 108 $map = array( 109 'keywords' => '2#025', 110 'date_creation' => '2#055', 111 'author' => '2#122', 112 'name' => '2#085', 113 'comment' => '2#120' 114 ); 140 global $conf; 141 142 $map = $conf['use_iptc_mapping']; 115 143 $datefields = array('date_creation', 'date_available'); 116 144
Note: See TracChangeset
for help on using the changeset viewer.