[1082] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[5196] | 5 | // | Copyright(C) 2008-2010 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 | { |
---|
[6484] | 32 | $exif_mapping = array(); |
---|
| 33 | foreach ($conf['show_exif_fields'] as $field) |
---|
| 34 | { |
---|
| 35 | $exif_mapping[$field] = $field; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | $exif = get_exif_data($picture['current']['image_path'], $exif_mapping); |
---|
[6093] | 39 | if (count($exif) == 0 and $picture['current']['has_high']) |
---|
| 40 | { |
---|
[6484] | 41 | $exif = get_exif_data($picture['current']['high_url'], $exif_mapping); |
---|
[6093] | 42 | } |
---|
[6484] | 43 | |
---|
[6093] | 44 | if (count($exif) > 0) |
---|
| 45 | { |
---|
[2227] | 46 | $tpl_meta = array( |
---|
| 47 | 'TITLE' => 'EXIF Metadata', |
---|
| 48 | 'lines' => array(), |
---|
[1126] | 49 | ); |
---|
| 50 | |
---|
| 51 | foreach ($conf['show_exif_fields'] as $field) |
---|
[1082] | 52 | { |
---|
[1126] | 53 | if (strpos($field, ';') === false) |
---|
[1082] | 54 | { |
---|
[1126] | 55 | if (isset($exif[$field])) |
---|
[1082] | 56 | { |
---|
[1126] | 57 | $key = $field; |
---|
| 58 | if (isset($lang['exif_field_'.$field])) |
---|
[1082] | 59 | { |
---|
[1126] | 60 | $key = $lang['exif_field_'.$field]; |
---|
| 61 | } |
---|
[2227] | 62 | $tpl_meta['lines'][$key] = $exif[$field]; |
---|
[1082] | 63 | } |
---|
[1126] | 64 | } |
---|
| 65 | else |
---|
| 66 | { |
---|
| 67 | $tokens = explode(';', $field); |
---|
[6484] | 68 | if (isset($exif[$field])) |
---|
[1082] | 69 | { |
---|
[1126] | 70 | $key = $tokens[1]; |
---|
[6484] | 71 | if (isset($lang['exif_field_'.$key])) |
---|
[1082] | 72 | { |
---|
[6484] | 73 | $key = $lang['exif_field_'.$key]; |
---|
[1126] | 74 | } |
---|
[6484] | 75 | $tpl_meta['lines'][$key] = $exif[$field]; |
---|
[1082] | 76 | } |
---|
| 77 | } |
---|
| 78 | } |
---|
[2227] | 79 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 80 | } |
---|
[1126] | 81 | } |
---|
[2227] | 82 | |
---|
[1126] | 83 | if ($conf['show_iptc']) |
---|
| 84 | { |
---|
[6093] | 85 | $iptc = get_iptc_data($picture['current']['image_path'], $conf['show_iptc_mapping']); |
---|
| 86 | if (count($iptc) == 0 and $picture['current']['has_high']) |
---|
| 87 | { |
---|
| 88 | $iptc = get_iptc_data($picture['current']['high_url'], $conf['show_iptc_mapping']); |
---|
| 89 | } |
---|
[1126] | 90 | |
---|
| 91 | if (count($iptc) > 0) |
---|
[1082] | 92 | { |
---|
[2227] | 93 | $tpl_meta = array( |
---|
| 94 | 'TITLE' => 'IPTC Metadata', |
---|
| 95 | 'lines' => array(), |
---|
[1126] | 96 | ); |
---|
[1082] | 97 | |
---|
[2227] | 98 | foreach ($iptc as $field => $value) |
---|
[1082] | 99 | { |
---|
[2227] | 100 | $key = $field; |
---|
| 101 | if (isset($lang[$field])) |
---|
| 102 | { |
---|
| 103 | $key = $lang[$field]; |
---|
| 104 | } |
---|
| 105 | $tpl_meta['lines'][$key] = $value; |
---|
[1082] | 106 | } |
---|
[2227] | 107 | $template->append('metadata', $tpl_meta); |
---|
[1082] | 108 | } |
---|
| 109 | } |
---|
| 110 | |
---|
[1126] | 111 | |
---|
[1903] | 112 | ?> |
---|