cvs: php4 /ext/exif example.php exif.c test.txt
| From: | Marcus B�rger | Date: | Fri, 08 Mar 2002 11:33:46 +0000 |
| Subject: | cvs: php4 /ext/exif example.php exif.c test.txt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9827@lists.php.net to get a copy of this message | ||
helly Fri Mar 8 06:33:46 2002 EDT
Added files:
/php4/ext/exif example.php
Modified files:
/php4/ext/exif exif.c test.txt
Log:
-change IsColor from non zero to 1
-new test and example for documentation
Index: php4/ext/exif/exif.c
diff -u php4/ext/exif/exif.c:1.55 php4/ext/exif/exif.c:1.56
--- php4/ext/exif/exif.c:1.55 Thu Mar 7 20:09:54 2002
+++ php4/ext/exif/exif.c Fri Mar 8 06:33:45 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: exif.c,v 1.55 2002/03/08 01:09:54 helly Exp $ */
+/* $Id: exif.c,v 1.56 2002/03/08 11:33:45 helly Exp $ */
/* ToDos
*
@@ -2373,7 +2373,7 @@
exif_iif_add_int( &ImageInfo, SECTION_COMPUTED, "Height", ImageInfo.Height);
exif_iif_add_int( &ImageInfo, SECTION_COMPUTED, "Width", ImageInfo.Width);
}
- exif_iif_add_tag( &ImageInfo, SECTION_COMPUTED, "IsColor", TAG_NONE, TAG_FMT_SLONG,
1, &ImageInfo.IsColor);
+ exif_iif_add_int( &ImageInfo, SECTION_COMPUTED, "IsColor", ImageInfo.IsColor);
if (ImageInfo.FocalLength) {
sprintf(tmp, "%4.1fmm", ImageInfo.FocalLength);
exif_iif_add_tag( &ImageInfo, SECTION_COMPUTED, "FocalLength", TAG_NONE,
TAG_FMT_STRING, strlen(tmp), tmp);
Index: php4/ext/exif/test.txt
diff -u php4/ext/exif/test.txt:1.5 php4/ext/exif/test.txt:1.6
--- php4/ext/exif/test.txt:1.5 Wed Mar 6 13:21:50 2002
+++ php4/ext/exif/test.txt Fri Mar 8 06:33:46 2002
@@ -4,6 +4,8 @@
*
* (c) Marcus Boerger, 2002
*
+ * $Id: test.txt,v 1.6 2002/03/08 11:33:46 helly Exp $
+ *
* Rename the file to test.php and read the instructions. If the
* script cannot be executed or does not generate any output check
* you error log. In most cases this would mean you found an error
@@ -16,6 +18,7 @@
$file = array_key_exists('thumbnail',$_REQUEST) ? $_REQUEST['thumbnail'] :
'';
//$file = '/t/temp/kodak-dc4800.tif';
//$file = '/t/temp/canon-ixus.jpg';
+//$file = '/t/temp/test2.jpg';
if ( $file) {
$image = exif_thumbnail($file);
if ( $image!==false) {
@@ -63,6 +66,7 @@
if ( $pos !== false
&& ( strtolower(substr($found,$pos+1))=='jpg'
|| strtolower(substr($found,$pos+1))=='tif'
+ || strtolower(substr($found,$pos+1))=='gif'
)
)
{
@@ -112,6 +116,7 @@
// Searches for $file in document tree. The path is ignored.
//
function AddInfo($Name,$Value) {
+ if (is_array($Value)) $Value = 'Array: ('.join(',',$Value).')';
$Value = nl2br($Value);
return
"<tr><td>$Name</td><td>$Value </td></tr>\n";
}
@@ -217,7 +222,7 @@
<h2>function exif_read_data for <?=count($possible)?> images</h2>
<table border='1' cellspacing='0' cellpadding='3'
summary="EXIF information">
<?php
-if (function_exists('read_exif_data')) {
+if (function_exists('exif_read_data')) {
$num = 0;
foreach($possible as $idx => $file) {
$num++;
@@ -234,6 +239,7 @@
error_log("exif_read_data($file,'COMMENT,IFD0,EXIF,APP12', true);",0);
$image = exif_read_data($file,'COMMENT,IFD0,EXIF,APP12',true);
$error = error_msg();// clear message
+ error_log("exif_read_data($file,'COMMENT,IFD0,EXIF,APP12', true): $error",0);
//error_log("exif_read_data($file)",0);
$res = '';
if ( $image === false) {
@@ -246,7 +252,7 @@
$len++;
$res .= AddInfo($Name,'Array('.count($Value).')');
foreach( $Value as $idx => $Entry) {
- if ($idx=='Thumbnail') $Entry = '<data>';
+ if ($idx==='Thumbnail') $Entry = '<data>';
$len++;
$res .= AddInfo($Name.':'.$idx,$Entry);
}
Index: php4/ext/exif/example.php
+++ php4/ext/exif/example.php
<?php
// (c) M.Boerger
//
// $Id: example.php,v 1.1 2002/03/08 11:33:45 helly Exp $
//
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
<html>
<head>
<title>exif_read_data example</title>
</head>
<body>
<?php
$exif = exif_read_data ('tests/test1.jpg','IFD0');
echo $exif===false ? "No header data found.<br>\n" : "Image contains
headers<br>";
$exif = exif_read_data ('tests/test2.jpg',0,true);
foreach($exif as $key=>$section) {
foreach($section as $name=>$val) {
echo "$key.$name: $val<br>\n";
}
}
?>
</body>
</html>