Merge branch 'integration'
[phpmyadmin-regexreplace.git] / libraries / mime.lib.php
blobb8d035a7b546b3aa7ab86edfbc833f1c71efc394
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * MIME detection code.
6 * @package phpMyAdmin
7 * @todo Maybe we could try to use fileinfo module if loaded
8 */
10 /**
11 * Tries to detect MIME type of content.
13 function PMA_detectMIME(&$test) {
14 $len = strlen($test);
15 if ($len >= 2 && $test[0] == chr(0xff) && $test[1] == chr(0xd8)) {
16 return 'image/jpeg';
18 if ($len >= 3 && substr($test, 0, 3) == 'GIF') {
19 return 'image/gif';
21 if ($len >= 4 && substr($test, 0, 4) == "\x89PNG") {
22 return 'image/png';
24 return 'application/octet-stream';