Changeset 619


Ignore:
Timestamp:
Nov 24, 2004, 10:43:33 PM (19 years ago)
Author:
plg
Message:

report correction on "only first IPTC keyword" retrieved in remote sites
elements listing creator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/create_listing_file.php

    r606 r619  
    5454$conf['use_iptc'] = false;
    5555
     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
    5667// +-----------------------------------------------------------------------+
    5768// |                               functions                               |
     
    8394      foreach (array_keys($rmap) as $iptc_key)
    8495      {
    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')
    8999          {
    90             $value = substr($value, 1);
     100            $value = implode(',',
     101                             array_map('clean_iptc_value',$iptc[$iptc_key]));
    91102          }
    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
    95108          foreach (array_keys($map, $iptc_key) as $pwg_key)
    96109          {
     
    104117}
    105118
     119/**
     120 * return a cleaned IPTC value
     121 *
     122 * @param string value
     123 * @return string
     124 */
     125function 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
    106138function get_sync_iptc_data($file)
    107139{
    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'];
    115143  $datefields = array('date_creation', 'date_available');
    116144 
Note: See TracChangeset for help on using the changeset viewer.