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