better use var_dump and EXPECTF

#seems i waited for EXPECTF
This commit is contained in:
Marcus Boerger 2002-10-23 23:51:15 +00:00
parent 74883a9583
commit 339dfe0cd2
2 changed files with 138 additions and 30 deletions

View File

@ -2,8 +2,6 @@
Check for exif_read_data
--SKIPIF--
<?php if (!extension_loaded("exif")) print "skip";?>
--POST--
--GET--
--FILE--
<?php
/*
@ -11,18 +9,73 @@ Check for exif_read_data
test2.jpg is the same image but contains Exif/Comment information and a
copy of test1.jpg as a thumbnail.
*/
$image = exif_read_data('./ext/exif/tests/test2.jpg','',true,false);
$accept = '';
foreach($image as $idx=>$section) {
$accept .= $section;
foreach($section as $name=>$value) {
if ( $idx!='FILE' || $name!='FileDateTime') {
$accept .= substr($name,0,2);
$accept .= $value;
}
}
}
echo $accept;
var_dump(exif_read_data('./ext/exif/tests/test2.jpg','',true,false));
?>
--EXPECT--
ArrayFitest2.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsExif test image.UsASCIICoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsASCIIArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
--EXPECTF--
array(5) {
["FILE"]=>
array(6) {
["FileName"]=>
string(9) "test2.jpg"
["FileDateTime"]=>
int(%d)
["FileSize"]=>
int(1240)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
}
["COMPUTED"]=>
array(12) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(1)
["ByteOrderMotorola"]=>
int(1)
["UserComment"]=>
string(16) "Exif test image."
["UserCommentEncoding"]=>
string(5) "ASCII"
["Copyright"]=>
string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
["Copyright.Photographer"]=>
string(19) "Photo (c) M.Boerger"
["Copyright.Editor"]=>
string(20) "Edited by M.Boerger."
["Thumbnail.FileType"]=>
int(2)
["Thumbnail.MimeType"]=>
string(10) "image/jpeg"
}
["IFD0"]=>
array(2) {
["Copyright"]=>
string(19) "Photo (c) M.Boerger"
["UserComment"]=>
string(5) "ASCII"
}
["THUMBNAIL"]=>
array(2) {
["JPEGInterchangeFormat"]=>
int(134)
["JPEGInterchangeFormatLength"]=>
int(523)
}
["COMMENT"]=>
array(3) {
[0]=>
string(11) "Comment #1."
[1]=>
string(11) "Comment #2."
[2]=>
string(13) "Comment #3end"
}
}

View File

@ -15,18 +15,73 @@ exif.encode_unicode=ISO-8859-15
copy of test1.jpg as a thumbnail.
test3.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
*/
$image = exif_read_data('./ext/exif/tests/test3.jpg','',true,false);
$accept = '';
foreach($image as $idx=>$section) {
$accept .= $section;
foreach($section as $name=>$value) {
if ( $idx!='FILE' || $name!='FileDateTime') {
$accept .= substr($name,0,2);
$accept .= $value;
}
}
}
echo $accept;
var_dump(exif_read_data('./ext/exif/tests/test3.jpg','',true,false));
?>
--EXPECT--
ArrayFitest3.jpgFi1240Fi2Miimage/jpegSeANY_TAG, IFD0, THUMBNAIL, COMMENTArrayhtwidth="1" height="1"He1Wi1Is1By1UsÄÖÜßäöüUsUNICODECoPhoto (c) M.Boerger, Edited by M.Boerger.CoPhoto (c) M.BoergerCoEdited by M.Boerger.Th2Thimage/jpegArrayCoPhoto (c) M.BoergerUsUNICODEArrayJP134JP523Array0Comment #1.1Comment #2.2Comment #3end
--EXPECTF--
array(5) {
["FILE"]=>
array(6) {
["FileName"]=>
string(9) "test3.jpg"
["FileDateTime"]=>
int(%s)
["FileSize"]=>
int(1240)
["FileType"]=>
int(2)
["MimeType"]=>
string(10) "image/jpeg"
["SectionsFound"]=>
string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
}
["COMPUTED"]=>
array(12) {
["html"]=>
string(20) "width="1" height="1""
["Height"]=>
int(1)
["Width"]=>
int(1)
["IsColor"]=>
int(1)
["ByteOrderMotorola"]=>
int(1)
["UserComment"]=>
string(7) "ÄÖÜßäöü"
["UserCommentEncoding"]=>
string(7) "UNICODE"
["Copyright"]=>
string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
["Copyright.Photographer"]=>
string(19) "Photo (c) M.Boerger"
["Copyright.Editor"]=>
string(20) "Edited by M.Boerger."
["Thumbnail.FileType"]=>
int(2)
["Thumbnail.MimeType"]=>
string(10) "image/jpeg"
}
["IFD0"]=>
array(2) {
["Copyright"]=>
string(19) "Photo (c) M.Boerger"
["UserComment"]=>
string(7) "UNICODE"
}
["THUMBNAIL"]=>
array(2) {
["JPEGInterchangeFormat"]=>
int(134)
["JPEGInterchangeFormatLength"]=>
int(523)
}
["COMMENT"]=>
array(3) {
[0]=>
string(11) "Comment #1."
[1]=>
string(11) "Comment #2."
[2]=>
string(13) "Comment #3end"
}
}