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(5) { 74 [0]=> 75 int(0) 76 [1]=> 77 int(0) 78 [2]=> 79 int(19) 80 [3]=> 81 string(20) "width="0" height="0"" 82 ["mime"]=> 83 string(10) "image/avif" 84 } 85 ["test1pix.bmp"]=> 86 array(6) { 87 [0]=> 88 int(1) 89 [1]=> 90 int(1) 91 [2]=> 92 int(6) 93 [3]=> 94 string(20) "width="1" height="1"" 95 ["bits"]=> 96 int(24) 97 ["mime"]=> 98 string(9) "image/bmp" 99 } 100 ["test1pix.jp2"]=> 101 array(7) { 102 [0]=> 103 int(1) 104 [1]=> 105 int(1) 106 [2]=> 107 int(10) 108 [3]=> 109 string(20) "width="1" height="1"" 110 ["bits"]=> 111 int(8) 112 ["channels"]=> 113 int(3) 114 ["mime"]=> 115 string(9) "image/jp2" 116 } 117 ["test1pix.jpc"]=> 118 array(7) { 119 [0]=> 120 int(1) 121 [1]=> 122 int(1) 123 [2]=> 124 int(9) 125 [3]=> 126 string(20) "width="1" height="1"" 127 ["bits"]=> 128 int(8) 129 ["channels"]=> 130 int(3) 131 ["mime"]=> 132 string(24) "application/octet-stream" 133 } 134 ["test1pix.jpg"]=> 135 array(7) { 136 [0]=> 137 int(1) 138 [1]=> 139 int(1) 140 [2]=> 141 int(2) 142 [3]=> 143 string(20) "width="1" height="1"" 144 ["bits"]=> 145 int(8) 146 ["channels"]=> 147 int(3) 148 ["mime"]=> 149 string(10) "image/jpeg" 150 } 151 ["test2pix.gif"]=> 152 array(7) { 153 [0]=> 154 int(2) 155 [1]=> 156 int(1) 157 [2]=> 158 int(1) 159 [3]=> 160 string(20) "width="2" height="1"" 161 ["bits"]=> 162 int(1) 163 ["channels"]=> 164 int(3) 165 ["mime"]=> 166 string(9) "image/gif" 167 } 168 ["test3llpix.webp"]=> 169 array(6) { 170 [0]=> 171 int(1) 172 [1]=> 173 int(3) 174 [2]=> 175 int(18) 176 [3]=> 177 string(20) "width="1" height="3"" 178 ["bits"]=> 179 int(8) 180 ["mime"]=> 181 string(10) "image/webp" 182 } 183 ["test3pix.webp"]=> 184 array(6) { 185 [0]=> 186 int(1) 187 [1]=> 188 int(3) 189 [2]=> 190 int(18) 191 [3]=> 192 string(20) "width="1" height="3"" 193 ["bits"]=> 194 int(8) 195 ["mime"]=> 196 string(10) "image/webp" 197 } 198 ["test4pix.gif"]=> 199 array(7) { 200 [0]=> 201 int(4) 202 [1]=> 203 int(1) 204 [2]=> 205 int(1) 206 [3]=> 207 string(20) "width="4" height="1"" 208 ["bits"]=> 209 int(2) 210 ["channels"]=> 211 int(3) 212 ["mime"]=> 213 string(9) "image/gif" 214 } 215 ["test4pix.iff"]=> 216 array(6) { 217 [0]=> 218 int(4) 219 [1]=> 220 int(1) 221 [2]=> 222 int(14) 223 [3]=> 224 string(20) "width="4" height="1"" 225 ["bits"]=> 226 int(4) 227 ["mime"]=> 228 string(9) "image/iff" 229 } 230 ["test4pix.png"]=> 231 array(6) { 232 [0]=> 233 int(4) 234 [1]=> 235 int(1) 236 [2]=> 237 int(3) 238 [3]=> 239 string(20) "width="4" height="1"" 240 ["bits"]=> 241 int(4) 242 ["mime"]=> 243 string(9) "image/png" 244 } 245 ["test4pix.psd"]=> 246 array(5) { 247 [0]=> 248 int(4) 249 [1]=> 250 int(1) 251 [2]=> 252 int(5) 253 [3]=> 254 string(20) "width="4" height="1"" 255 ["mime"]=> 256 string(9) "image/psd" 257 } 258 ["test4pix.swf"]=> 259 array(5) { 260 [0]=> 261 int(550) 262 [1]=> 263 int(400) 264 [2]=> 265 int(4) 266 [3]=> 267 string(24) "width="550" height="400"" 268 ["mime"]=> 269 string(29) "application/x-shockwave-flash" 270 } 271 ["test4pix.tiff"]=> 272 array(5) { 273 [0]=> 274 int(4) 275 [1]=> 276 int(1) 277 [2]=> 278 int(7) 279 [3]=> 280 string(20) "width="4" height="1"" 281 ["mime"]=> 282 string(10) "image/tiff" 283 } 284} 285