1--TEST-- 2image_type_to_mime_type() 3--SKIPIF-- 4<?php 5 if (!function_exists('image_type_to_mime_type')) die('skip image_type_to_mime_type() not available'); 6 require_once('skipif_imagetype.inc'); 7?> 8--FILE-- 9<?php 10 // Note: SWC requires zlib 11 $dir = opendir(dirname(__FILE__)) or die('cannot open directory: '.dirname(__FILE__)); 12 $result = array(); 13 $files = array(); 14 while (($file = readdir($dir)) !== FALSE) { 15 if (preg_match('/^test.+pix\./',$file) && $file != "test13pix.swf") { 16 $files[] = $file; 17 } 18 } 19 closedir($dir); 20 sort($files); 21 foreach($files as $file) { 22 $result[$file] = getimagesize(dirname(__FILE__)."/$file"); 23 $result[$file] = image_type_to_mime_type($result[$file][2]); 24 } 25 var_dump($result); 26?> 27--EXPECT-- 28array(11) { 29 ["test1pix.bmp"]=> 30 string(14) "image/x-ms-bmp" 31 ["test1pix.jp2"]=> 32 string(9) "image/jp2" 33 ["test1pix.jpc"]=> 34 string(24) "application/octet-stream" 35 ["test1pix.jpg"]=> 36 string(10) "image/jpeg" 37 ["test2pix.gif"]=> 38 string(9) "image/gif" 39 ["test4pix.gif"]=> 40 string(9) "image/gif" 41 ["test4pix.iff"]=> 42 string(9) "image/iff" 43 ["test4pix.png"]=> 44 string(9) "image/png" 45 ["test4pix.psd"]=> 46 string(9) "image/psd" 47 ["test4pix.swf"]=> 48 string(29) "application/x-shockwave-flash" 49 ["test4pix.tif"]=> 50 string(10) "image/tiff" 51}