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

Last change on this file since 1644 was 1590, checked in by rvelices, 18 years ago

plugins last modifications + events are triggered now from picture.php

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 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-11-01 05:54:35 +0000 (Wed, 01 Nov 2006) $
10// | last modifier : $Author: rvelices $
11// | revision      : $Revision: 1590 $
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    $template->assign_block_vars(
45      'metadata.headline',
46      array('TITLE' => 'EXIF Metadata')
47      );
48
49    foreach ($conf['show_exif_fields'] as $field)
50    {
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          }
60
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          }
80
81          $template->assign_block_vars(
82            'metadata.line',
83            array(
84              'KEY' => $key,
85              'VALUE' => $exif[$tokens[0]][$tokens[1]]
86              )
87            );
88        }
89      }
90    }
91  }
92}
93if ($conf['show_iptc'])
94{
95  $iptc = get_iptc_data($picture['current']['image_path'],
96                        $conf['show_iptc_mapping']);
97
98  if (count($iptc) > 0)
99  {
100    $template->assign_block_vars(
101      'metadata.headline',
102      array('TITLE' => 'IPTC Metadata')
103      );
104  }
105
106  foreach ($iptc as $field => $value)
107  {
108    $key = $field;
109    if (isset($lang[$field]))
110    {
111      $key = $lang[$field];
112    }
113
114    $template->assign_block_vars(
115      'metadata.line',
116      array(
117        'KEY' => $key,
118        'VALUE' => $value
119        )
120      );
121  }
122}
123
124
125?>
Note: See TracBrowser for help on using the repository browser.