From 9c8ad6614f5526cc98f4b18fcfaa69cb8e4b3a0a Mon Sep 17 00:00:00 2001
From: Marcus Boerger
Date: Mon, 4 Mar 2002 06:26:07 +0000
Subject: [PATCH] -Updated test.txt and provided test.php # simply including
test.txt @Added test.php/txt to have a possibility to check ext/exif
@(Marcus)
---
ext/exif/test.php | 3 ++
ext/exif/test.txt | 105 +++++++++++++++++++++++++++++++---------------
2 files changed, 75 insertions(+), 33 deletions(-)
create mode 100644 ext/exif/test.php
diff --git a/ext/exif/test.php b/ext/exif/test.php
new file mode 100644
index 0000000000..907b9ea080
--- /dev/null
+++ b/ext/exif/test.php
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/ext/exif/test.txt b/ext/exif/test.txt
index d20427d0b4..bf9b90b0d5 100644
--- a/ext/exif/test.txt
+++ b/ext/exif/test.txt
@@ -23,8 +23,12 @@ function message($msg) {
}
function error_msg() {
- if (array_key_exists('php_errormsg',$GLOBALS)) return $GLOBALS['php_errormsg'];
- return 'php.ini: track_errors is off';
+ $ret = 'O.K.';
+ if (array_key_exists('php_errormsg',$GLOBALS) && strlen($GLOBALS['php_errormsg'])) {
+ $ret = ''.$GLOBALS['php_errormsg'].'';
+ $GLOBALS['php_errormsg'] = '';
+ }
+ return $ret;
}
/****************************************************************************/
@@ -39,17 +43,22 @@ function _search_file($root,&$possible,$path='') {
//error_log("search_file($root$path):$type=$found",0);
switch( $type) {
case 'file':
- $pos = strpos($found,'.');
- if ( $pos !== false && strtolower(substr($found,$pos+1))=='jpg') {
- $possible[] = $root.$path.'/'.$found;
- //error_log("search_file($root$path) add:$path/$found",0);
- }
- break;
+ $pos = strpos($found,'.');
+ if ( $pos !== false
+ && ( strtolower(substr($found,$pos+1))=='jpg'
+ || strtolower(substr($found,$pos+1))=='tif'
+ )
+ )
+ {
+ $possible[] = $root.$path.'/'.$found;
+ //error_log("search_file($root$path) add:$path/$found",0);
+ }
+ break;
case 'dir':
- if ( $found!='.' && $found!='..') {
- $sub[count($sub)] = $found;
- }
- break;
+ if ( $found!='.' && $found!='..') {
+ $sub[count($sub)] = $found;
+ }
+ break;
}
}
@closedir($dir);
@@ -70,8 +79,10 @@ function search_file() {
if ( array_key_exists('SCRIPT_FILENAME',$_SERVER)) {
$path = $_SERVER['SCRIPT_FILENAME'];
+ //error_log("SCRIPT_FILENAME($path)",0);
} else {
$path = $argv[0];
+ //error_log("argv($path)",0);
}
if ( ($p=strpos($path,'?')) !== false) $path = substr($path,0,$p);
if ( ($p=strrpos($path,'/')) < strlen($path)-1) $path = substr($path,0,$p);
@@ -91,10 +102,12 @@ function AddInfo($Name,$Value) {
$possible = search_file();
+$title = "PHP module exif test page";
+
?>
-PHP moduls exif test page
+=$title ?>
-Test script for PHP module ext/exif
-
-(c) Marcus Boerger, 2002
+
=$title ?>
+(c) Marcus Boerger, 2002
Images taken from www.exif.org,
@@ -139,12 +154,31 @@ What to look for in detail:
- kodak-dc4800-plus-acdsee.jpg
- - should provide a long comment 'by marcus börger<%04i>'*n
+ - should provide a long comment 'by marcus börger<%04i>'*n
+ - this file returns an array but it also produces an errormessage because ACDSee destroys
+ the integrity of IFD directory (size of directory and offsets of entries following any
+ edited entry maybe wrong).
+
+
+
+- hp-photosmart.jpg
+
+ - should provide a two line copyright notice
+
+
+- olympus-d320l
+
+ - should provide an APP12 infoset
-- hp-photosmart
+
- unknown.jpg
- - should provide a ***two line*** copyright notice
+ - should provide an empty comment, this is a comment section and not an IFD0, EXIF or GPS section
+
+
+- some images
+
+ - have empty fields, that is the tag is present but no data is stored
@@ -164,7 +198,7 @@ if (function_exists('exif_headername')) {
?>
-function read_exif_data for =count($possible)?> images
+function exif_read_data for =count($possible)?> images
$Value) {
- if ( $Name!='Thumbnail') {
- if ( is_array($Value)) {
- $len++;
- $res .= AddInfo($Name,'Array('.count($Value).')');
- foreach( $Value as $idx => $Entry) {
+ //error_log("exif_read_data($file)",0);
+ if ( $image === false) {
+ $error = 'exif_read_data returned false
'.$error;
+ } else {
+ foreach($image as $Name => $Value) {
+ if ( $Name!='Thumbnail') {
+ if ( is_array($Value)) {
+ $len++;
+ $res .= AddInfo($Name,'Array('.count($Value).')');
+ foreach( $Value as $idx => $Entry) {
+ $len++;
+ $res .= AddInfo($Name.':'.$idx,$Entry);
+ }
+ } else {
$len++;
- $res .= AddInfo($Name.':'.$idx,$Entry);
+ $res .= AddInfo($Name,$Value);
}
- } else {
- $len++;
- $res .= AddInfo($Name,$Value);
}
}
}
echo "$num |
$file | $error |
\n$res";
}
} else {
- echo "function read_exif_data is not supported |
\n";
+ echo "function exif_read_data is not supported |
\n";
}
?>
--
2.40.0