-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTIFFExample.php
More file actions
132 lines (112 loc) · 6.48 KB
/
TIFFExample.php
File metadata and controls
132 lines (112 loc) · 6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--***************************************************************************
*
* Filename: TIFFExample.php
*
* Description: An example of how the PHP JPEG Metadata Toolkit can be used to
* display TIFF Metadata.
*
* Author: Evan Hunter
*
* Date: 30/7/2004
*
* Project: PHP JPEG Metadata Toolkit
*
* Revision: 1.12
*
* Changes: 1.10 -> 1.11 : Changed displayed toolkit version numbers to reference Toolkit_Version.php
* 1.11 -> 1.12 : Added parsing of filename to prevent attacks, changed to use _GET variable
*
* URL: http://electronics.ozhiker.com
*
* Copyright: Copyright Evan Hunter 2004
*
* License: This file is part of the PHP JPEG Metadata Toolkit.
*
* The PHP JPEG Metadata Toolkit is free software; you can
* redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* The PHP JPEG Metadata Toolkit is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without
* even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public
* License along with the PHP JPEG Metadata Toolkit; if not,
* write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* If you require a different license for commercial or other
* purposes, please contact the author: evan@ozhiker.com
*
***************************************************************************-->
<head>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<style type="text/css" media="screen, print, projection">
<!--
BODY { background-color:#505050; color:#F0F0F0 }
a { color:orange }
.EXIF_Main_Heading { color:red }
.EXIF_Secondary_Heading{ color: orange}
.EXIF_Table { border-collapse: collapse ; border: 1px solid #909000}
.EXIF_Table tbody td{border-width: 1px; border-style:solid; border-color: #909000;}
-->
</style>
<?php
// Turn off Error Reporting
error_reporting ( 0 );
// Hide any unknown EXIF tags
$GLOBALS['HIDE_UNKNOWN_TAGS'] = TRUE;
include 'Toolkit_Version.php';
include 'EXIF.php';
// Retrieve the TIFF image filename from the http url request
if ( ( !array_key_exists( 'tiff_fname', $_GET ) ) ||
( $_GET['tiff_fname'] == "" ) )
{
echo "<title>No image filename defined</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<p>No image filename defined - use GET method with field: tiff_fname</p>\n";
echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11
echo "</body>\n";
exit( );
}
else
{
$filename = $_GET['tiff_fname'];
// Sanitize the filename to remove any hack attempts
if ( 0 == preg_match ( '/^\.?\/?([_A-Za-z0-9]+\.tif?f)$/i', $filename ) )
{
echo "<title>Bad image filename defined</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<p>Bad image filename defined - Must be tif or tiff</p>\n";
echo "<p><a href=\"http://www.ozhiker.com/electronics/pjmt/\" >PHP JPEG Metadata Toolkit version " . $GLOBALS['Toolkit_Version'] . ", Copyright (C) 2004 Evan Hunter</a></p>\n"; // Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11
echo "</body>\n";
exit( );
}
}
?>
<title>Metadata details for <?php echo $filename; ?></title>
</head>
<body>
<div>
<p >Interpreted using: <a href="http://www.ozhiker.com/electronics/pjmt/">PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 -->
<br/>
<h2><b><u>Metadata for "<?php echo $filename; ?>"</u></b></h2>
<!-- Output the EXIF Information -->
<?php echo Interpret_EXIF_to_HTML( get_EXIF_TIFF( $filename ), $filename ); ?>
<br/>
<br/>
<br/>
<p>Interpreted using:</p>
<p><a href="http://www.ozhiker.com/electronics/pjmt/" >PHP JPEG Metadata Toolkit version <?php echo $GLOBALS['Toolkit_Version'] ?>, Copyright (C) 2004 Evan Hunter</a></p> <!-- Change: displayed toolkit version numbers to reference Toolkit_Version.php - as of version 1.11 -->
</div>
</body>
</html>