xref: /PHP-8.1/ext/exif/tests/exif003.phpt (revision bd9f4fa6)
1--TEST--
2Check for exif_read_data, Unicode user comment
3--EXTENSIONS--
4exif
5mbstring
6--SKIPIF--
7<?php
8    if (!defined("EXIF_USE_MBSTRING") || !EXIF_USE_MBSTRING) die ('skip mbstring loaded by dl');
9?>
10--INI--
11output_handler=
12zlib.output_compression=0
13exif.decode_unicode_motorola=UCS-2BE
14exif.encode_unicode=ISO-8859-15
15--FILE--
16<?php
17/*
18  test1.jpg is a 1*1 image that does not contain any Exif/Comment information
19  test2.jpg is the same image but contains Exif/Comment information and a
20            copy of test1.jpg as a thumbnail.
21  test3.jpg is the same as test2.jpg but with a UNICODE UserComment: &Auml;&Ouml;&&Uuml;&szlig;&auml;&ouml;&uuml;
22*/
23var_dump(exif_read_data(__DIR__.'/test3.jpg','',true,false));
24?>
25--EXPECTF--
26array(5) {
27  ["FILE"]=>
28  array(6) {
29    ["FileName"]=>
30    string(9) "test3.jpg"
31    ["FileDateTime"]=>
32    int(%s)
33    ["FileSize"]=>
34    int(1240)
35    ["FileType"]=>
36    int(2)
37    ["MimeType"]=>
38    string(10) "image/jpeg"
39    ["SectionsFound"]=>
40    string(33) "ANY_TAG, IFD0, THUMBNAIL, COMMENT"
41  }
42  ["COMPUTED"]=>
43  array(12) {
44    ["html"]=>
45    string(20) "width="1" height="1""
46    ["Height"]=>
47    int(1)
48    ["Width"]=>
49    int(1)
50    ["IsColor"]=>
51    int(1)
52    ["ByteOrderMotorola"]=>
53    int(1)
54    ["UserComment"]=>
55    string(7) "�������"
56    ["UserCommentEncoding"]=>
57    string(7) "UNICODE"
58    ["Copyright"]=>
59    string(41) "Photo (c) M.Boerger, Edited by M.Boerger."
60    ["Copyright.Photographer"]=>
61    string(19) "Photo (c) M.Boerger"
62    ["Copyright.Editor"]=>
63    string(20) "Edited by M.Boerger."
64    ["Thumbnail.FileType"]=>
65    int(2)
66    ["Thumbnail.MimeType"]=>
67    string(10) "image/jpeg"
68  }
69  ["IFD0"]=>
70  array(2) {
71    ["Copyright"]=>
72    string(19) "Photo (c) M.Boerger"
73    ["UserComment"]=>
74    string(7) "UNICODE"
75  }
76  ["THUMBNAIL"]=>
77  array(2) {
78    ["JPEGInterchangeFormat"]=>
79    int(134)
80    ["JPEGInterchangeFormatLength"]=>
81    int(523)
82  }
83  ["COMMENT"]=>
84  array(3) {
85    [0]=>
86    string(11) "Comment #1."
87    [1]=>
88    string(11) "Comment #2."
89    [2]=>
90    string(13) "Comment #3end"
91  }
92}
93