Changeset 1126


Ignore:
Timestamp:
Apr 5, 2006, 4:18:27 AM (18 years ago)
Author:
rvelices
Message:

fix: picture iptc metadata not showing due to url rewriting

File:
1 edited

Legend:

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

    r1092 r1126  
    33// | PhpWebGallery - a PHP based picture gallery                           |
    44// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
    5 // | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net |
     5// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    77// | branch        : BSF (Best So Far)
     
    3131 */
    3232
    33 if ($metadata_showable and isset($_GET['metadata']))
     33include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
     34$template->assign_block_vars('metadata', array());
     35if ($conf['show_exif'])
    3436{
    35   include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
    36   $template->assign_block_vars('metadata', array());
    37   if ($conf['show_exif'])
     37  if (!function_exists('read_exif_data'))
    3838  {
    39     if (!function_exists('read_exif_data'))
     39    die('Exif extension not available, admin should disable exif display');
     40  }
     41
     42  if ($exif = @read_exif_data($picture['current']['src_file_system']))
     43  {
     44    $template->assign_block_vars(
     45      'metadata.headline',
     46      array('TITLE' => 'EXIF Metadata')
     47      );
     48
     49    foreach ($conf['show_exif_fields'] as $field)
    4050    {
    41       die('Exif extension not available, admin should disable exif display');
    42     }
     51      if (strpos($field, ';') === false)
     52      {
     53        if (isset($exif[$field]))
     54        {
     55          $key = $field;
     56          if (isset($lang['exif_field_'.$field]))
     57          {
     58            $key = $lang['exif_field_'.$field];
     59          }
    4360
    44     if ($exif = @read_exif_data($picture['current']['src_file_system']))
    45     {
    46       $template->assign_block_vars(
    47         'metadata.headline',
    48         array('TITLE' => 'EXIF Metadata')
    49         );
     61          $template->assign_block_vars(
     62            'metadata.line',
     63            array(
     64              'KEY' => $key,
     65              'VALUE' => $exif[$field]
     66              )
     67            );
     68        }
     69      }
     70      else
     71      {
     72        $tokens = explode(';', $field);
     73        if (isset($exif[$tokens[0]][$tokens[1]]))
     74        {
     75          $key = $tokens[1];
     76          if (isset($lang['exif_field_'.$tokens[1]]))
     77          {
     78            $key = $lang['exif_field_'.$tokens[1]];
     79          }
    5080
    51       foreach ($conf['show_exif_fields'] as $field)
    52       {
    53         if (strpos($field, ';') === false)
    54         {
    55           if (isset($exif[$field]))
    56           {
    57             $key = $field;
    58             if (isset($lang['exif_field_'.$field]))
    59             {
    60               $key = $lang['exif_field_'.$field];
    61             }
    62 
    63             $template->assign_block_vars(
    64               'metadata.line',
    65               array(
    66                 'KEY' => $key,
    67                 'VALUE' => $exif[$field]
    68                 )
    69               );
    70           }
    71         }
    72         else
    73         {
    74           $tokens = explode(';', $field);
    75           if (isset($exif[$tokens[0]][$tokens[1]]))
    76           {
    77             $key = $tokens[1];
    78             if (isset($lang['exif_field_'.$tokens[1]]))
    79             {
    80               $key = $lang['exif_field_'.$tokens[1]];
    81             }
    82 
    83             $template->assign_block_vars(
    84               'metadata.line',
    85               array(
    86                 'KEY' => $key,
    87                 'VALUE' => $exif[$tokens[0]][$tokens[1]]
    88                 )
    89               );
    90           }
     81          $template->assign_block_vars(
     82            'metadata.line',
     83            array(
     84              'KEY' => $key,
     85              'VALUE' => $exif[$tokens[0]][$tokens[1]]
     86              )
     87            );
    9188        }
    9289      }
    9390    }
    9491  }
    95   if ($conf['show_iptc'])
     92}
     93if ($conf['show_iptc'])
     94{
     95  $iptc = get_iptc_data($picture['current']['src_file_system'],
     96                        $conf['show_iptc_mapping']);
     97
     98  if (count($iptc) > 0)
    9699  {
    97     $iptc = get_iptc_data($picture['current']['src'],
    98                           $conf['show_iptc_mapping']);
     100    $template->assign_block_vars(
     101      'metadata.headline',
     102      array('TITLE' => 'IPTC Metadata')
     103      );
     104  }
    99105
    100     if (count($iptc) > 0)
     106  foreach ($iptc as $field => $value)
     107  {
     108    $key = $field;
     109    if (isset($lang[$field]))
    101110    {
    102       $template->assign_block_vars(
    103         'metadata.headline',
    104         array('TITLE' => 'IPTC Metadata')
    105         );
     111      $key = $lang[$field];
    106112    }
    107113
    108     foreach ($iptc as $field => $value)
    109     {
    110       $key = $field;
    111       if (isset($lang[$field]))
    112       {
    113         $key = $lang[$field];
    114       }
    115 
    116       $template->assign_block_vars(
    117         'metadata.line',
    118         array(
    119           'KEY' => $key,
    120           'VALUE' => $value
    121           )
    122         );
    123     }
     114    $template->assign_block_vars(
     115      'metadata.line',
     116      array(
     117        'KEY' => $key,
     118        'VALUE' => $value
     119        )
     120      );
    124121  }
    125122}
    126123
     124
    127125?>
Note: See TracChangeset for help on using the changeset viewer.