1--TEST-- 2GetImageSize() 3--SKIPIF-- 4<?php 5 require_once('skipif_imagetype.inc'); 6?> 7--FILE-- 8<?php 9 // Note: SWC requires zlib 10 $dir = opendir(__DIR__) or die('cannot open directory: '.__DIR__); 11 $result = array(); 12 $files = array(); 13 while (($file = readdir($dir)) !== FALSE) { 14 if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { 15 $files[] = $file; 16 } 17 } 18 closedir($dir); 19 sort($files); 20 foreach($files as $file) { 21 $result[$file] = getimagesize(__DIR__."/$file"); 22 } 23 var_dump($result); 24?> 25--EXPECT-- 26array(17) { 27 ["test-1pix.bmp"]=> 28 array(6) { 29 [0]=> 30 int(1) 31 [1]=> 32 int(1) 33 [2]=> 34 int(6) 35 [3]=> 36 string(20) "width="1" height="1"" 37 ["bits"]=> 38 int(24) 39 ["mime"]=> 40 string(9) "image/bmp" 41 } 42 ["test12pix.webp"]=> 43 array(6) { 44 [0]=> 45 int(4) 46 [1]=> 47 int(3) 48 [2]=> 49 int(18) 50 [3]=> 51 string(20) "width="4" height="3"" 52 ["bits"]=> 53 int(8) 54 ["mime"]=> 55 string(10) "image/webp" 56 } 57 ["test1bpix.bmp"]=> 58 array(6) { 59 [0]=> 60 int(1) 61 [1]=> 62 int(1) 63 [2]=> 64 int(6) 65 [3]=> 66 string(20) "width="1" height="1"" 67 ["bits"]=> 68 int(32) 69 ["mime"]=> 70 string(9) "image/bmp" 71 } 72 ["test1pix.avif"]=> 73 array(7) { 74 [0]=> 75 int(102) 76 [1]=> 77 int(121) 78 [2]=> 79 int(19) 80 [3]=> 81 string(24) "width="102" height="121"" 82 ["bits"]=> 83 int(8) 84 ["channels"]=> 85 int(4) 86 ["mime"]=> 87 string(10) "image/avif" 88 } 89 ["test1pix.bmp"]=> 90 array(6) { 91 [0]=> 92 int(1) 93 [1]=> 94 int(1) 95 [2]=> 96 int(6) 97 [3]=> 98 string(20) "width="1" height="1"" 99 ["bits"]=> 100 int(24) 101 ["mime"]=> 102 string(9) "image/bmp" 103 } 104 ["test1pix.jp2"]=> 105 array(7) { 106 [0]=> 107 int(1) 108 [1]=> 109 int(1) 110 [2]=> 111 int(10) 112 [3]=> 113 string(20) "width="1" height="1"" 114 ["bits"]=> 115 int(8) 116 ["channels"]=> 117 int(3) 118 ["mime"]=> 119 string(9) "image/jp2" 120 } 121 ["test1pix.jpc"]=> 122 array(7) { 123 [0]=> 124 int(1) 125 [1]=> 126 int(1) 127 [2]=> 128 int(9) 129 [3]=> 130 string(20) "width="1" height="1"" 131 ["bits"]=> 132 int(8) 133 ["channels"]=> 134 int(3) 135 ["mime"]=> 136 string(24) "application/octet-stream" 137 } 138 ["test1pix.jpg"]=> 139 array(7) { 140 [0]=> 141 int(1) 142 [1]=> 143 int(1) 144 [2]=> 145 int(2) 146 [3]=> 147 string(20) "width="1" height="1"" 148 ["bits"]=> 149 int(8) 150 ["channels"]=> 151 int(3) 152 ["mime"]=> 153 string(10) "image/jpeg" 154 } 155 ["test2pix.gif"]=> 156 array(7) { 157 [0]=> 158 int(2) 159 [1]=> 160 int(1) 161 [2]=> 162 int(1) 163 [3]=> 164 string(20) "width="2" height="1"" 165 ["bits"]=> 166 int(1) 167 ["channels"]=> 168 int(3) 169 ["mime"]=> 170 string(9) "image/gif" 171 } 172 ["test3llpix.webp"]=> 173 array(6) { 174 [0]=> 175 int(1) 176 [1]=> 177 int(3) 178 [2]=> 179 int(18) 180 [3]=> 181 string(20) "width="1" height="3"" 182 ["bits"]=> 183 int(8) 184 ["mime"]=> 185 string(10) "image/webp" 186 } 187 ["test3pix.webp"]=> 188 array(6) { 189 [0]=> 190 int(1) 191 [1]=> 192 int(3) 193 [2]=> 194 int(18) 195 [3]=> 196 string(20) "width="1" height="3"" 197 ["bits"]=> 198 int(8) 199 ["mime"]=> 200 string(10) "image/webp" 201 } 202 ["test4pix.gif"]=> 203 array(7) { 204 [0]=> 205 int(4) 206 [1]=> 207 int(1) 208 [2]=> 209 int(1) 210 [3]=> 211 string(20) "width="4" height="1"" 212 ["bits"]=> 213 int(2) 214 ["channels"]=> 215 int(3) 216 ["mime"]=> 217 string(9) "image/gif" 218 } 219 ["test4pix.iff"]=> 220 array(6) { 221 [0]=> 222 int(4) 223 [1]=> 224 int(1) 225 [2]=> 226 int(14) 227 [3]=> 228 string(20) "width="4" height="1"" 229 ["bits"]=> 230 int(4) 231 ["mime"]=> 232 string(9) "image/iff" 233 } 234 ["test4pix.png"]=> 235 array(6) { 236 [0]=> 237 int(4) 238 [1]=> 239 int(1) 240 [2]=> 241 int(3) 242 [3]=> 243 string(20) "width="4" height="1"" 244 ["bits"]=> 245 int(4) 246 ["mime"]=> 247 string(9) "image/png" 248 } 249 ["test4pix.psd"]=> 250 array(5) { 251 [0]=> 252 int(4) 253 [1]=> 254 int(1) 255 [2]=> 256 int(5) 257 [3]=> 258 string(20) "width="4" height="1"" 259 ["mime"]=> 260 string(9) "image/psd" 261 } 262 ["test4pix.swf"]=> 263 array(5) { 264 [0]=> 265 int(550) 266 [1]=> 267 int(400) 268 [2]=> 269 int(4) 270 [3]=> 271 string(24) "width="550" height="400"" 272 ["mime"]=> 273 string(29) "application/x-shockwave-flash" 274 } 275 ["test4pix.tiff"]=> 276 array(5) { 277 [0]=> 278 int(4) 279 [1]=> 280 int(1) 281 [2]=> 282 int(7) 283 [3]=> 284 string(20) "width="4" height="1"" 285 ["mime"]=> 286 string(10) "image/tiff" 287 } 288} 289