Ignore:
Timestamp:
Nov 20, 2004, 7:07:51 PM (19 years ago)
Author:
plg
Message:

takes not only the first keyword in IPTC field 2#025

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_metadata.inc.php

    r593 r611  
    5151      foreach (array_keys($rmap) as $iptc_key)
    5252      {
    53         if (isset($iptc[$iptc_key][0]) and $value = $iptc[$iptc_key][0])
     53        if (isset($iptc[$iptc_key][0]))
    5454        {
    55           // strip leading zeros (weird Kodak Scanner software)
    56           while ($value[0] == chr(0))
     55          if ($iptc_key == '2#025')
    5756          {
    58             $value = substr($value, 1);
     57            $value = implode(',',
     58                             array_map('clean_iptc_value',$iptc[$iptc_key]));
    5959          }
    60           // remove binary nulls
    61           $value = str_replace(chr(0x00), ' ', $value);
    62          
     60          else
     61          {
     62            $value = clean_iptc_value($iptc[$iptc_key][0]);
     63          }
     64
    6365          foreach (array_keys($map, $iptc_key) as $pwg_key)
    6466          {
     
    7173  return $result;
    7274}
     75
     76/**
     77 * return a cleaned IPTC value
     78 *
     79 * @param string value
     80 * @return string
     81 */
     82function clean_iptc_value($value)
     83{
     84  // strip leading zeros (weird Kodak Scanner software)
     85  while ($value[0] == chr(0))
     86  {
     87    $value = substr($value, 1);
     88  }
     89  // remove binary nulls
     90  $value = str_replace(chr(0x00), ' ', $value);
     91 
     92  return $value;
     93}
    7394?>
Note: See TracChangeset for help on using the changeset viewer.