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

Last change on this file since 2297 was 2297, checked in by plg, 16 years ago

Modification: new header on PHP files, PhpWebGallery renamed Piwigo.

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