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

Last change on this file since 1655 was 1655, checked in by rvelices, 17 years ago
  • plugins admin menu appear now in the admin page menubar
  • plugins are loaded immediately after loading the config (allow

them to hack more of pwg like user init, template init etc...)

  • trigger event format_exif_data (for picture display only)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 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-2006 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2006-12-14 00:58:57 +0000 (Thu, 14 Dec 2006) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 1655 $
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
30 *
31 */
32
33include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php');
34$template->assign_block_vars('metadata', array());
35if ($conf['show_exif'])
36{
37  if (!function_exists('read_exif_data'))
38  {
39    die('Exif extension not available, admin should disable exif display');
40  }
41
42  if ($exif = @read_exif_data($picture['current']['image_path']))
43  {
44    $exif = trigger_event('format_exif_data', $exif, $picture['current'] );
45    $template->assign_block_vars(
46      'metadata.headline',
47      array('TITLE' => 'EXIF Metadata')
48      );
49
50    foreach ($conf['show_exif_fields'] as $field)
51    {
52      if (strpos($field, ';') === false)
53      {
54        if (isset($exif[$field]))
55        {
56          $key = $field;
57          if (isset($lang['exif_field_'.$field]))
58          {
59            $key = $lang['exif_field_'.$field];
60          }
61
62          $template->assign_block_vars(
63            'metadata.line',
64            array(
65              'KEY' => $key,
66              'VALUE' => $exif[$field]
67              )
68            );
69        }
70      }
71      else
72      {
73        $tokens = explode(';', $field);
74        if (isset($exif[$tokens[0]][$tokens[1]]))
75        {
76          $key = $tokens[1];
77          if (isset($lang['exif_field_'.$tokens[1]]))
78          {
79            $key = $lang['exif_field_'.$tokens[1]];
80          }
81
82          $template->assign_block_vars(
83            'metadata.line',
84            array(
85              'KEY' => $key,
86              'VALUE' => $exif[$tokens[0]][$tokens[1]]
87              )
88            );
89        }
90      }
91    }
92  }
93}
94if ($conf['show_iptc'])
95{
96  $iptc = get_iptc_data($picture['current']['image_path'],
97                        $conf['show_iptc_mapping']);
98
99  if (count($iptc) > 0)
100  {
101    $template->assign_block_vars(
102      'metadata.headline',
103      array('TITLE' => 'IPTC Metadata')
104      );
105  }
106
107  foreach ($iptc as $field => $value)
108  {
109    $key = $field;
110    if (isset($lang[$field]))
111    {
112      $key = $lang[$field];
113    }
114
115    $template->assign_block_vars(
116      'metadata.line',
117      array(
118        'KEY' => $key,
119        'VALUE' => $value
120        )
121      );
122  }
123}
124
125
126?>
Note: See TracBrowser for help on using the repository browser.