[1082] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[8728] | 3 | // | Piwigo - a PHP based photo gallery | |
---|
[2297] | 4 | // +-----------------------------------------------------------------------+ |
---|
[12922] | 5 | // | Copyright(C) 2008-2012 Piwigo Team http://piwigo.org | |
---|
[2297] | 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 | // +-----------------------------------------------------------------------+ |
---|
[1082] | 23 | |
---|
| 24 | /** |
---|
| 25 | * This file is included by the picture page to manage picture metadata |
---|
[1092] | 26 | * |
---|
[1082] | 27 | */ |
---|
| 28 | |
---|
[8631] | 29 | |
---|
[1126] | 30 | include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); |
---|
[1682] | 31 | if (($conf['show_exif']) and (function_exists('read_exif_data'))) |
---|
[1082] | 32 | { |
---|
[6484] | 33 | $exif_mapping = array(); |
---|
| 34 | foreach ($conf['show_exif_fields'] as $field) |
---|
| 35 | { |
---|
| 36 | $exif_mapping[$field] = $field; |
---|
| 37 | } |
---|
| 38 | |
---|
[12797] | 39 | $exif = get_exif_data($picture['current']['src_image']->get_path(), $exif_mapping); |
---|
[6484] | 40 | |
---|
[6093] | 41 | if (count($exif) > 0) |
---|
| 42 | { |
---|
[2227] | 43 | $tpl_meta = array( |
---|
[12131] | 44 | 'TITLE' => l10n('EXIF Metadata'), |
---|
[2227] | 45 | 'lines' => array(), |
---|
[1126] | 46 | ); |
---|
| 47 | |
---|
| 48 | foreach ($conf['show_exif_fields'] as $field) |
---|
[1082] | 49 | { |
---|
[1126] | 50 | if (strpos($field, ';') === false) |
---|
[1082] | 51 | { |
---|
[1126] | 52 | if (isset($exif[$field])) |
---|
[1082] | 53 | { |
---|
[1126] | 54 | $key = $field; |
---|
| 55 | if (isset($lang['exif_field_'.$field])) |
---|
[1082] | 56 | { |
---|
[1126] | 57 | $key = $lang['exif_field_'.$field]; |
---|
| 58 | } |
---|
[2227] | 59 | $tpl_meta['lines'][$key] = $exif[$field]; |
---|
[1082] | 60 | } |
---|
[1126] | 61 | } |
---|
| 62 | else |
---|
| 63 | { |
---|
| 64 | $tokens = explode(';', $field); |
---|
[6484] | 65 | if (isset($exif[$field])) |
---|
[1082] | 66 | { |
---|
[1126] | 67 | $key = $tokens[1]; |
---|
[6484] | 68 | if (isset($lang['exif_field_'.$key])) |
---|
[1082] | 69 | { |
---|
[6484] | 70 | $key = $lang['exif_field_'.$key]; |
---|
[1126] | 71 | } |
---|
[6484] | 72 | $tpl_meta['lines'][$key] = $exif[$field]; |
---|
[1082] | 73 | } |
---|
| 74 | } |
---|
| 75 | } |
---|
[2227] | 76 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 77 | } |
---|
[1126] | 78 | } |
---|
[2227] | 79 | |
---|
[1126] | 80 | if ($conf['show_iptc']) |
---|
| 81 | { |
---|
[12797] | 82 | $iptc = get_iptc_data($picture['current']['src_image']->get_path(), $conf['show_iptc_mapping']); |
---|
[1126] | 83 | |
---|
| 84 | if (count($iptc) > 0) |
---|
[1082] | 85 | { |
---|
[2227] | 86 | $tpl_meta = array( |
---|
[12131] | 87 | 'TITLE' => l10n('IPTC Metadata'), |
---|
[2227] | 88 | 'lines' => array(), |
---|
[1126] | 89 | ); |
---|
[1082] | 90 | |
---|
[2227] | 91 | foreach ($iptc as $field => $value) |
---|
[1082] | 92 | { |
---|
[2227] | 93 | $key = $field; |
---|
| 94 | if (isset($lang[$field])) |
---|
| 95 | { |
---|
| 96 | $key = $lang[$field]; |
---|
| 97 | } |
---|
| 98 | $tpl_meta['lines'][$key] = $value; |
---|
[1082] | 99 | } |
---|
[2227] | 100 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 101 | } |
---|
| 102 | } |
---|
| 103 | |
---|
[1126] | 104 | |
---|
[12796] | 105 | ?> |
---|