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

Last change on this file since 2227 was 2227, checked in by rvelices, 16 years ago

picture, footer and picture modify template migration

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | PhpWebGallery - a PHP based picture gallery                           |
4// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
5// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | file          : $Id: picture_metadata.inc.php 2227 2008-02-29 01:25:13Z rvelices $
8// | last update   : $Date: 2008-02-29 01:25:13 +0000 (Fri, 29 Feb 2008) $
9// | last modifier : $Author: rvelices $
10// | revision      : $Revision: 2227 $
11// +-----------------------------------------------------------------------+
12// | This program is free software; you can redistribute it and/or modify  |
13// | it under the terms of the GNU General Public License as published by  |
14// | the Free Software Foundation                                          |
15// |                                                                       |
16// | This program is distributed in the hope that it will be useful, but   |
17// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
18// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
19// | General Public License for more details.                              |
20// |                                                                       |
21// | You should have received a copy of the GNU General Public License     |
22// | along with this program; if not, write to the Free Software           |
23// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
24// | USA.                                                                  |
25// +-----------------------------------------------------------------------+
26
27/**
28 * This file is included by the picture page to manage picture metadata
29 *
30 */
31
32include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
33if (($conf['show_exif']) and (function_exists('read_exif_data')))
34{
35  if ($exif = @read_exif_data($picture['current']['image_path']))
36  {
37    $exif = trigger_event('format_exif_data', $exif, $picture['current'] );
38
39    $tpl_meta = array(
40        'TITLE' => 'EXIF Metadata',
41        'lines' => array(),
42      );
43
44    foreach ($conf['show_exif_fields'] as $field)
45    {
46      if (strpos($field, ';') === false)
47      {
48        if (isset($exif[$field]))
49        {
50          $key = $field;
51          if (isset($lang['exif_field_'.$field]))
52          {
53            $key = $lang['exif_field_'.$field];
54          }
55          $tpl_meta['lines'][$key] = $exif[$field];
56        }
57      }
58      else
59      {
60        $tokens = explode(';', $field);
61        if (isset($exif[$tokens[0]][$tokens[1]]))
62        {
63          $key = $tokens[1];
64          if (isset($lang['exif_field_'.$tokens[1]]))
65          {
66            $key = $lang['exif_field_'.$tokens[1]];
67          }
68          $tpl_meta['lines'][$key] = $exif[$tokens[0]][$tokens[1]];
69        }
70      }
71    }
72    $template->append('metadata', $tpl_meta);
73  }
74}
75
76if ($conf['show_iptc'])
77{
78  $iptc = get_iptc_data($picture['current']['image_path'],
79                        $conf['show_iptc_mapping']);
80
81  if (count($iptc) > 0)
82  {
83    $tpl_meta = array(
84        'TITLE' => 'IPTC Metadata',
85        'lines' => array(),
86      );
87
88    foreach ($iptc as $field => $value)
89    {
90      $key = $field;
91      if (isset($lang[$field]))
92      {
93        $key = $lang[$field];
94      }
95      $tpl_meta['lines'][$key] = $value;
96    }
97    $template->append('metadata', $tpl_meta);
98  }
99}
100
101
102?>
Note: See TracBrowser for help on using the repository browser.