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