[1082] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[3046] | 5 | // | Copyright(C) 2008-2009 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 | |
---|
[1126] | 29 | include_once(PHPWG_ROOT_PATH.'/include/functions_metadata.inc.php'); |
---|
[1682] | 30 | if (($conf['show_exif']) and (function_exists('read_exif_data'))) |
---|
[1082] | 31 | { |
---|
[1590] | 32 | if ($exif = @read_exif_data($picture['current']['image_path'])) |
---|
[1126] | 33 | { |
---|
[1655] | 34 | $exif = trigger_event('format_exif_data', $exif, $picture['current'] ); |
---|
[2227] | 35 | |
---|
| 36 | $tpl_meta = array( |
---|
| 37 | 'TITLE' => 'EXIF Metadata', |
---|
| 38 | 'lines' => array(), |
---|
[1126] | 39 | ); |
---|
| 40 | |
---|
| 41 | foreach ($conf['show_exif_fields'] as $field) |
---|
[1082] | 42 | { |
---|
[1126] | 43 | if (strpos($field, ';') === false) |
---|
[1082] | 44 | { |
---|
[1126] | 45 | if (isset($exif[$field])) |
---|
[1082] | 46 | { |
---|
[1126] | 47 | $key = $field; |
---|
| 48 | if (isset($lang['exif_field_'.$field])) |
---|
[1082] | 49 | { |
---|
[1126] | 50 | $key = $lang['exif_field_'.$field]; |
---|
| 51 | } |
---|
[2227] | 52 | $tpl_meta['lines'][$key] = $exif[$field]; |
---|
[1082] | 53 | } |
---|
[1126] | 54 | } |
---|
| 55 | else |
---|
| 56 | { |
---|
| 57 | $tokens = explode(';', $field); |
---|
| 58 | if (isset($exif[$tokens[0]][$tokens[1]])) |
---|
[1082] | 59 | { |
---|
[1126] | 60 | $key = $tokens[1]; |
---|
| 61 | if (isset($lang['exif_field_'.$tokens[1]])) |
---|
[1082] | 62 | { |
---|
[1126] | 63 | $key = $lang['exif_field_'.$tokens[1]]; |
---|
| 64 | } |
---|
[2227] | 65 | $tpl_meta['lines'][$key] = $exif[$tokens[0]][$tokens[1]]; |
---|
[1082] | 66 | } |
---|
| 67 | } |
---|
| 68 | } |
---|
[2227] | 69 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 70 | } |
---|
[1126] | 71 | } |
---|
[2227] | 72 | |
---|
[1126] | 73 | if ($conf['show_iptc']) |
---|
| 74 | { |
---|
[1590] | 75 | $iptc = get_iptc_data($picture['current']['image_path'], |
---|
[1126] | 76 | $conf['show_iptc_mapping']); |
---|
| 77 | |
---|
| 78 | if (count($iptc) > 0) |
---|
[1082] | 79 | { |
---|
[2227] | 80 | $tpl_meta = array( |
---|
| 81 | 'TITLE' => 'IPTC Metadata', |
---|
| 82 | 'lines' => array(), |
---|
[1126] | 83 | ); |
---|
[1082] | 84 | |
---|
[2227] | 85 | foreach ($iptc as $field => $value) |
---|
[1082] | 86 | { |
---|
[2227] | 87 | $key = $field; |
---|
| 88 | if (isset($lang[$field])) |
---|
| 89 | { |
---|
| 90 | $key = $lang[$field]; |
---|
| 91 | } |
---|
| 92 | $tpl_meta['lines'][$key] = $value; |
---|
[1082] | 93 | } |
---|
[2227] | 94 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 95 | } |
---|
| 96 | } |
---|
| 97 | |
---|
[1126] | 98 | |
---|
[1903] | 99 | ?> |
---|