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