2 /* vim: set expandtab sw=4 ts=4 sts=4: */
7 * @todo Maybe we could try to use fileinfo module if loaded
9 declare(strict_types
=1);
14 * PhpMyAdmin\Mime class;
21 * Tries to detect MIME type of content.
23 * @param string $test First few bytes of content to use for detection
27 public static function detect(&$test)
29 $len = mb_strlen($test);
30 if ($len >= 2 && $test[0] == chr(0xff) && $test[1] == chr(0xd8)) {
33 if ($len >= 3 && substr($test, 0, 3) == 'GIF') {
36 if ($len >= 4 && mb_substr($test, 0, 4) == "\x89PNG") {
39 return 'application/octet-stream';