Subversion Repositories svnkaklik

Rev

Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
6 kaklik 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-2005 PhpWebGallery Team - http://phpwebgallery.net |
6
// +-----------------------------------------------------------------------+
7
// | branch        : BSF (Best So Far)
8
// | file          : $RCSfile: metadata.php,v $
9
// | last update   : $Date: 2005/01/07 23:10:51 $
10
// | last modifier : $Author: plg $
11
// | revision      : $Revision: 1.3 $
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
$filename = 'sample.jpg';
29
echo 'Informations are read from '.$filename.'<br /><br /><br />';
30
 
31
$iptc_result = array();
32
$imginfo = array();
33
getimagesize($filename, $imginfo);
34
if (isset($imginfo['APP13']))
35
{
36
  $iptc = iptcparse($imginfo['APP13']);
37
  if (is_array($iptc))
38
  {
39
    foreach (array_keys($iptc) as $iptc_key)
40
    {
41
      if (isset($iptc[$iptc_key][0]) and $value = $iptc[$iptc_key][0])
42
      {
43
        // strip leading zeros (weird Kodak Scanner software)
44
        while ($value[0] == chr(0))
45
        {
46
          $value = substr($value, 1);
47
        }
48
        // remove binary nulls
49
        $value = str_replace(chr(0x00), ' ', $value);
50
      }
51
      $iptc_result[$iptc_key] = $value;
52
    }
53
  }
54
 
55
  echo 'IPTC Fields in '.$filename.'<br />';
56
  $keys = array_keys($iptc_result);
57
  sort($keys);
58
  foreach ($keys as $key)
59
  {
60
    echo '<br />'.$key.' = '.$iptc_result[$key];
61
  }
62
}
63
else
64
{
65
  echo 'no IPTC information';
66
}
67
 
68
echo '<br /><br /><br />';
69
echo 'EXIF Fields in '.$filename.'<br />';
70
$exif = read_exif_data($filename);
71
echo '<pre>';
72
print_r($exif);
73
echo '</pre>';
74
?>