Skip to content

Commit ac80c9d

Browse files
committed
- standard test scripts for exif
#hope all problems in exif are resolved now
1 parent 0a0942b commit ac80c9d

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

ext/exif/tests/001.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Check for exif_read_data
3+
--SKIPIF--
4+
<?php if (!extension_loaded("exif")) print "skip";?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
/*
10+
test1.jpg is a 1*1 image that does not contain any Exif/Comment information
11+
test2.jpg is the same image but contains Exif/Comment information and a
12+
copy of test1.jpg as a thumbnail.
13+
*/
14+
$image = exif_read_data('test2.jpg','',true,false);
15+
$accept = '';
16+
foreach($image as $idx=>$section) {
17+
$accept .= $section;
18+
foreach($section as $name=>$value) {
19+
$accept .= substr($name,0,2);
20+
$accept .= $value;
21+
}
22+
}
23+
echo $accept;
24+
?>
25+
--EXPECT--
26+
ArrayFitest2.jpgFi1015448798Fi1240SeCOMPUTED, ANY_TAG, IFD0, THUMBNAIL, COMMENT, EXIFArrayCoPhoto (c) M.BoergerCoEdited by M.Boerger.htwidth="1" height="1"He1Wi1Is1UsExif test image.UsASCIIArrayCoPhoto (c) M.BoergerUsASCIIArrayJP523Array0Comment #1.1Comment #2.2Comment #3end

ext/exif/tests/002.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Check for exif_thumbnail
3+
--SKIPIF--
4+
<?php if (!extension_loaded("exif")) print "skip";?>
5+
--POST--
6+
--GET--
7+
--FILE--
8+
<?php
9+
/*
10+
test1.jpg is a 1*1 image that does not contain any Exif/Comment information
11+
test2.jpg is the same image but contains Exif/Comment information and a
12+
copy of test1.jpg as a thumbnail.
13+
*/
14+
$istat= stat('test1.jpg');
15+
$fp = fopen('test1.jpg','r');
16+
$image = fread($fp,$istat[7]);
17+
echo substr($image,490,5).'_'.$istat[7];
18+
fclose($fp);
19+
$thumb = exif_thumbnail('test2.jpg');
20+
echo strcmp($image,$thumb) ? 'different' : '_identical_';
21+
echo strlen($thumb);
22+
echo '_'.substr($thumb,490,5);
23+
/* 7GWgw_523_identical_523_7GWgw */
24+
?>
25+
--EXPECT--
26+
7GWgw_523_identical_523_7GWgw

ext/exif/tests/test1.jpg

523 Bytes
Loading

ext/exif/tests/test2.jpg

1.21 KB
Loading

0 commit comments

Comments
 (0)