Changeset 1222
- Timestamp:
- Apr 20, 2006, 11:12:45 PM (19 years ago)
- Location:
- branches/branch-1_6
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_6/admin/include/functions_metadata.php
r1127 r1222 54 54 $iptc['keywords'] = preg_replace('/[.;]/', ',', $iptc['keywords']); 55 55 $iptc['keywords'] = preg_replace('/^,+|,+$/', '', $iptc['keywords']); 56 57 $iptc['keywords'] = implode( 58 ',', 59 array_unique( 60 explode( 61 ',', 62 $iptc['keywords'] 63 ) 64 ) 65 ); 56 66 } 57 67 -
branches/branch-1_6/tools/metadata.php
r675 r1222 29 29 echo 'Informations are read from '.$filename.'<br /><br /><br />'; 30 30 31 /** 32 * return a cleaned IPTC value 33 * 34 * @param string value 35 * @return string 36 */ 37 function clean_iptc_value($value) 38 { 39 // strip leading zeros (weird Kodak Scanner software) 40 while ( isset($value[0]) and $value[0] == chr(0)) 41 { 42 $value = substr($value, 1); 43 } 44 // remove binary nulls 45 $value = str_replace(chr(0x00), ' ', $value); 46 47 return $value; 48 } 49 31 50 $iptc_result = array(); 32 51 $imginfo = array(); … … 39 58 foreach (array_keys($iptc) as $iptc_key) 40 59 { 41 if (isset($iptc[$iptc_key][0]) and $value = $iptc[$iptc_key][0])60 if (isset($iptc[$iptc_key][0])) 42 61 { 43 // strip leading zeros (weird Kodak Scanner software) 44 while ($value[0] == chr(0)) 62 if ($iptc_key == '2#025') 45 63 { 46 $value = substr($value, 1); 64 $value = implode( 65 ',', 66 array_map( 67 'clean_iptc_value', 68 $iptc[$iptc_key] 69 ) 70 ); 47 71 } 48 // remove binary nulls 49 $value = str_replace(chr(0x00), ' ', $value); 72 else 73 { 74 $value = clean_iptc_value($iptc[$iptc_key][0]); 75 } 76 77 $iptc_result[$iptc_key] = $value; 50 78 } 51 $iptc_result[$iptc_key] = $value;52 79 } 53 80 }
Note: See TracChangeset
for help on using the changeset viewer.