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?> 7--FILE-- 8<?php 9 10/* Prototype : string image_type_to_mime_type ( int $imagetype ) 11 * Description: Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype. 12 * Source code: ext/standard/image.c 13 * Alias to functions: 14 */ 15 16echo "Starting image_type_to_mime_type() test\n\n"; 17 18$image_types = array ( 19 IMAGETYPE_GIF, 20 IMAGETYPE_JPEG, 21 IMAGETYPE_PNG, 22 IMAGETYPE_SWF, 23 IMAGETYPE_PSD, 24 IMAGETYPE_BMP, 25 IMAGETYPE_TIFF_II, 26 IMAGETYPE_TIFF_MM, 27 IMAGETYPE_JPC, 28 IMAGETYPE_JP2, 29 IMAGETYPE_JPX, 30 IMAGETYPE_JB2, 31 IMAGETYPE_IFF, 32 IMAGETYPE_WBMP, 33 IMAGETYPE_JPEG2000, 34 IMAGETYPE_XBM 35); 36 37 foreach($image_types as $image_type) { 38 var_dump(image_type_to_mime_type($image_type)); 39 } 40 41echo "\nDone image_type_to_mime_type() test\n"; 42?> 43--EXPECT-- 44Starting image_type_to_mime_type() test 45 46string(9) "image/gif" 47string(10) "image/jpeg" 48string(9) "image/png" 49string(29) "application/x-shockwave-flash" 50string(9) "image/psd" 51string(14) "image/x-ms-bmp" 52string(10) "image/tiff" 53string(10) "image/tiff" 54string(24) "application/octet-stream" 55string(9) "image/jp2" 56string(24) "application/octet-stream" 57string(24) "application/octet-stream" 58string(9) "image/iff" 59string(18) "image/vnd.wap.wbmp" 60string(24) "application/octet-stream" 61string(9) "image/xbm" 62 63Done image_type_to_mime_type() test 64