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(13) { 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(14) "image/x-ms-bmp" 41 } 42 ["test1bpix.bmp"]=> 43 array(6) { 44 [0]=> 45 int(500) 46 [1]=> 47 int(345) 48 [2]=> 49 int(6) 50 [3]=> 51 string(24) "width="500" height="345"" 52 ["bits"]=> 53 int(32) 54 ["mime"]=> 55 string(14) "image/x-ms-bmp" 56 } 57 ["test1pix.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(24) 69 ["mime"]=> 70 string(14) "image/x-ms-bmp" 71 } 72 ["test1pix.jp2"]=> 73 array(7) { 74 [0]=> 75 int(1) 76 [1]=> 77 int(1) 78 [2]=> 79 int(10) 80 [3]=> 81 string(20) "width="1" height="1"" 82 ["bits"]=> 83 int(8) 84 ["channels"]=> 85 int(3) 86 ["mime"]=> 87 string(9) "image/jp2" 88 } 89 ["test1pix.jpc"]=> 90 array(7) { 91 [0]=> 92 int(1) 93 [1]=> 94 int(1) 95 [2]=> 96 int(9) 97 [3]=> 98 string(20) "width="1" height="1"" 99 ["bits"]=> 100 int(8) 101 ["channels"]=> 102 int(3) 103 ["mime"]=> 104 string(24) "application/octet-stream" 105 } 106 ["test1pix.jpg"]=> 107 array(7) { 108 [0]=> 109 int(1) 110 [1]=> 111 int(1) 112 [2]=> 113 int(2) 114 [3]=> 115 string(20) "width="1" height="1"" 116 ["bits"]=> 117 int(8) 118 ["channels"]=> 119 int(3) 120 ["mime"]=> 121 string(10) "image/jpeg" 122 } 123 ["test2pix.gif"]=> 124 array(7) { 125 [0]=> 126 int(2) 127 [1]=> 128 int(1) 129 [2]=> 130 int(1) 131 [3]=> 132 string(20) "width="2" height="1"" 133 ["bits"]=> 134 int(1) 135 ["channels"]=> 136 int(3) 137 ["mime"]=> 138 string(9) "image/gif" 139 } 140 ["test4pix.gif"]=> 141 array(7) { 142 [0]=> 143 int(4) 144 [1]=> 145 int(1) 146 [2]=> 147 int(1) 148 [3]=> 149 string(20) "width="4" height="1"" 150 ["bits"]=> 151 int(2) 152 ["channels"]=> 153 int(3) 154 ["mime"]=> 155 string(9) "image/gif" 156 } 157 ["test4pix.iff"]=> 158 array(6) { 159 [0]=> 160 int(4) 161 [1]=> 162 int(1) 163 [2]=> 164 int(14) 165 [3]=> 166 string(20) "width="4" height="1"" 167 ["bits"]=> 168 int(4) 169 ["mime"]=> 170 string(9) "image/iff" 171 } 172 ["test4pix.png"]=> 173 array(6) { 174 [0]=> 175 int(4) 176 [1]=> 177 int(1) 178 [2]=> 179 int(3) 180 [3]=> 181 string(20) "width="4" height="1"" 182 ["bits"]=> 183 int(4) 184 ["mime"]=> 185 string(9) "image/png" 186 } 187 ["test4pix.psd"]=> 188 array(5) { 189 [0]=> 190 int(4) 191 [1]=> 192 int(1) 193 [2]=> 194 int(5) 195 [3]=> 196 string(20) "width="4" height="1"" 197 ["mime"]=> 198 string(9) "image/psd" 199 } 200 ["test4pix.swf"]=> 201 array(5) { 202 [0]=> 203 int(550) 204 [1]=> 205 int(400) 206 [2]=> 207 int(4) 208 [3]=> 209 string(24) "width="550" height="400"" 210 ["mime"]=> 211 string(29) "application/x-shockwave-flash" 212 } 213 ["test4pix.tif"]=> 214 array(5) { 215 [0]=> 216 int(4) 217 [1]=> 218 int(1) 219 [2]=> 220 int(7) 221 [3]=> 222 string(20) "width="4" height="1"" 223 ["mime"]=> 224 string(10) "image/tiff" 225 } 226} 227