1--TEST--
2Test getimagesize() function : basic functionality
3--FILE--
4<?php
5$imagetype_filenames = array(
6      // GIF file
7      "GIF image file" => "200x100.gif",
8
9      //JPEG file
10      "JPEG image file" => "200x100.jpg",
11
12      //PNG file
13      "PNG image file" => "200x100.png",
14
15      //SWF file
16      "SWF image file" => "200x100.swf",
17
18      //BMP file
19      "BMP image file" => "200x100.bmp",
20
21      //TIFF intel byte order
22      "TIFF intel byte order image file" => "200x100.tiff",
23
24      //JPC file
25      "JPC image file" => "test1pix.jpc",
26
27      //JP2 file
28      "JP2 image file" => "test1pix.jp2",
29
30      //IFF file
31      "IFF image file" => "test4pix.iff"
32);
33
34echo "*** Testing getimagesize() : basic functionality ***\n";
35
36// loop through each element of the array for imagetype
37foreach($imagetype_filenames as $key => $filename) {
38      echo "\n-- $key ($filename) --\n";
39      var_dump( getimagesize(__DIR__."/$filename", $info) );
40      var_dump( $info );
41};
42?>
43--EXPECTF--
44*** Testing getimagesize() : basic functionality ***
45
46-- GIF image file (200x100.gif) --
47array(7) {
48  [0]=>
49  int(200)
50  [1]=>
51  int(100)
52  [2]=>
53  int(1)
54  [3]=>
55  string(24) "width="200" height="100""
56  ["bits"]=>
57  int(8)
58  ["channels"]=>
59  int(3)
60  ["mime"]=>
61  string(9) "image/gif"
62}
63array(0) {
64}
65
66-- JPEG image file (200x100.jpg) --
67array(7) {
68  [0]=>
69  int(200)
70  [1]=>
71  int(100)
72  [2]=>
73  int(2)
74  [3]=>
75  string(24) "width="200" height="100""
76  ["bits"]=>
77  int(8)
78  ["channels"]=>
79  int(3)
80  ["mime"]=>
81  string(10) "image/jpeg"
82}
83array(1) {
84  ["APP0"]=>
85  string(%d)%s
86}
87
88-- PNG image file (200x100.png) --
89array(6) {
90  [0]=>
91  int(200)
92  [1]=>
93  int(100)
94  [2]=>
95  int(3)
96  [3]=>
97  string(24) "width="200" height="100""
98  ["bits"]=>
99  int(8)
100  ["mime"]=>
101  string(9) "image/png"
102}
103array(0) {
104}
105
106-- SWF image file (200x100.swf) --
107array(5) {
108  [0]=>
109  int(200)
110  [1]=>
111  int(100)
112  [2]=>
113  int(4)
114  [3]=>
115  string(24) "width="200" height="100""
116  ["mime"]=>
117  string(29) "application/x-shockwave-flash"
118}
119array(0) {
120}
121
122-- BMP image file (200x100.bmp) --
123array(6) {
124  [0]=>
125  int(200)
126  [1]=>
127  int(100)
128  [2]=>
129  int(6)
130  [3]=>
131  string(24) "width="200" height="100""
132  ["bits"]=>
133  int(24)
134  ["mime"]=>
135  string(9) "image/bmp"
136}
137array(0) {
138}
139
140-- TIFF intel byte order image file (200x100.tiff) --
141array(5) {
142  [0]=>
143  int(200)
144  [1]=>
145  int(100)
146  [2]=>
147  int(7)
148  [3]=>
149  string(24) "width="200" height="100""
150  ["mime"]=>
151  string(10) "image/tiff"
152}
153array(0) {
154}
155
156-- JPC image file (test1pix.jpc) --
157array(7) {
158  [0]=>
159  int(1)
160  [1]=>
161  int(1)
162  [2]=>
163  int(9)
164  [3]=>
165  string(20) "width="1" height="1""
166  ["bits"]=>
167  int(8)
168  ["channels"]=>
169  int(3)
170  ["mime"]=>
171  string(24) "application/octet-stream"
172}
173array(0) {
174}
175
176-- JP2 image file (test1pix.jp2) --
177array(7) {
178  [0]=>
179  int(1)
180  [1]=>
181  int(1)
182  [2]=>
183  int(10)
184  [3]=>
185  string(20) "width="1" height="1""
186  ["bits"]=>
187  int(8)
188  ["channels"]=>
189  int(3)
190  ["mime"]=>
191  string(9) "image/jp2"
192}
193array(0) {
194}
195
196-- IFF image file (test4pix.iff) --
197array(6) {
198  [0]=>
199  int(4)
200  [1]=>
201  int(1)
202  [2]=>
203  int(14)
204  [3]=>
205  string(20) "width="4" height="1""
206  ["bits"]=>
207  int(4)
208  ["mime"]=>
209  string(9) "image/iff"
210}
211array(0) {
212}
213