source: trunk/include/picture_metadata.inc.php @ 1522

Last change on this file since 1522 was 1126, checked in by rvelices, 18 years ago

fix: picture iptc metadata not showing due to url rewriting

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
RevLine 
[1082]1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
[1126]5// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net |
[1082]6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
[1092]9// | last update   : $Date: 2006-04-05 02:18:27 +0000 (Wed, 05 Apr 2006) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 1126 $
[1082]12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28/**
29 * This file is included by the picture page to manage picture metadata
[1092]30 *
[1082]31 */
32
[1126]33include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
34$template->assign_block_vars('metadata', array());
35if ($conf['show_exif'])
[1082]36{
[1126]37  if (!function_exists('read_exif_data'))
[1082]38  {
[1126]39    die('Exif extension not available, admin should disable exif display');
40  }
[1082]41
[1126]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)
[1082]50    {
[1126]51      if (strpos($field, ';') === false)
[1082]52      {
[1126]53        if (isset($exif[$field]))
[1082]54        {
[1126]55          $key = $field;
56          if (isset($lang['exif_field_'.$field]))
[1082]57          {
[1126]58            $key = $lang['exif_field_'.$field];
59          }
[1082]60
[1126]61          $template->assign_block_vars(
62            'metadata.line',
63            array(
64              'KEY' => $key,
65              'VALUE' => $exif[$field]
66              )
67            );
[1082]68        }
[1126]69      }
70      else
71      {
72        $tokens = explode(';', $field);
73        if (isset($exif[$tokens[0]][$tokens[1]]))
[1082]74        {
[1126]75          $key = $tokens[1];
76          if (isset($lang['exif_field_'.$tokens[1]]))
[1082]77          {
[1126]78            $key = $lang['exif_field_'.$tokens[1]];
79          }
[1082]80
[1126]81          $template->assign_block_vars(
82            'metadata.line',
83            array(
84              'KEY' => $key,
85              'VALUE' => $exif[$tokens[0]][$tokens[1]]
86              )
87            );
[1082]88        }
89      }
90    }
91  }
[1126]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)
[1082]99  {
[1126]100    $template->assign_block_vars(
101      'metadata.headline',
102      array('TITLE' => 'IPTC Metadata')
103      );
104  }
[1082]105
[1126]106  foreach ($iptc as $field => $value)
107  {
108    $key = $field;
109    if (isset($lang[$field]))
[1082]110    {
[1126]111      $key = $lang[$field];
[1082]112    }
113
[1126]114    $template->assign_block_vars(
115      'metadata.line',
116      array(
117        'KEY' => $key,
118        'VALUE' => $value
119        )
120      );
[1082]121  }
122}
123
[1126]124
[1082]125?>
Note: See TracBrowser for help on using the repository browser.