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