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(11) { 27 ["test1pix.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 ["test1pix.jp2"]=> 43 array(7) { 44 [0]=> 45 int(1) 46 [1]=> 47 int(1) 48 [2]=> 49 int(10) 50 [3]=> 51 string(20) "width="1" height="1"" 52 ["bits"]=> 53 int(8) 54 ["channels"]=> 55 int(3) 56 ["mime"]=> 57 string(9) "image/jp2" 58 } 59 ["test1pix.jpc"]=> 60 array(7) { 61 [0]=> 62 int(1) 63 [1]=> 64 int(1) 65 [2]=> 66 int(9) 67 [3]=> 68 string(20) "width="1" height="1"" 69 ["bits"]=> 70 int(8) 71 ["channels"]=> 72 int(3) 73 ["mime"]=> 74 string(24) "application/octet-stream" 75 } 76 ["test1pix.jpg"]=> 77 array(7) { 78 [0]=> 79 int(1) 80 [1]=> 81 int(1) 82 [2]=> 83 int(2) 84 [3]=> 85 string(20) "width="1" height="1"" 86 ["bits"]=> 87 int(8) 88 ["channels"]=> 89 int(3) 90 ["mime"]=> 91 string(10) "image/jpeg" 92 } 93 ["test2pix.gif"]=> 94 array(7) { 95 [0]=> 96 int(2) 97 [1]=> 98 int(1) 99 [2]=> 100 int(1) 101 [3]=> 102 string(20) "width="2" height="1"" 103 ["bits"]=> 104 int(1) 105 ["channels"]=> 106 int(3) 107 ["mime"]=> 108 string(9) "image/gif" 109 } 110 ["test4pix.gif"]=> 111 array(7) { 112 [0]=> 113 int(4) 114 [1]=> 115 int(1) 116 [2]=> 117 int(1) 118 [3]=> 119 string(20) "width="4" height="1"" 120 ["bits"]=> 121 int(2) 122 ["channels"]=> 123 int(3) 124 ["mime"]=> 125 string(9) "image/gif" 126 } 127 ["test4pix.iff"]=> 128 array(6) { 129 [0]=> 130 int(4) 131 [1]=> 132 int(1) 133 [2]=> 134 int(14) 135 [3]=> 136 string(20) "width="4" height="1"" 137 ["bits"]=> 138 int(4) 139 ["mime"]=> 140 string(9) "image/iff" 141 } 142 ["test4pix.png"]=> 143 array(6) { 144 [0]=> 145 int(4) 146 [1]=> 147 int(1) 148 [2]=> 149 int(3) 150 [3]=> 151 string(20) "width="4" height="1"" 152 ["bits"]=> 153 int(4) 154 ["mime"]=> 155 string(9) "image/png" 156 } 157 ["test4pix.psd"]=> 158 array(5) { 159 [0]=> 160 int(4) 161 [1]=> 162 int(1) 163 [2]=> 164 int(5) 165 [3]=> 166 string(20) "width="4" height="1"" 167 ["mime"]=> 168 string(9) "image/psd" 169 } 170 ["test4pix.swf"]=> 171 array(5) { 172 [0]=> 173 int(550) 174 [1]=> 175 int(400) 176 [2]=> 177 int(4) 178 [3]=> 179 string(24) "width="550" height="400"" 180 ["mime"]=> 181 string(29) "application/x-shockwave-flash" 182 } 183 ["test4pix.tif"]=> 184 array(5) { 185 [0]=> 186 int(4) 187 [1]=> 188 int(1) 189 [2]=> 190 int(7) 191 [3]=> 192 string(20) "width="4" height="1"" 193 ["mime"]=> 194 string(10) "image/tiff" 195 } 196} 197