public static function get_mime_type($filename) {
		if (extension_loaded('fileinfo')) {
			try {
				$finfo = new \finfo(FILEINFO_MIME_TYPE);
				return $finfo->file($filename);
			} catch (\Exception $e) {
				// Try next option...
			}
		}

		if (function_exists('mime_content_type')) {
			try {
				return mime_content_type($filename);
			} catch (\Exception $e) {
				// Try next option...
			}
		}

		$mime = \pdyn\filesystem\Mimetype::ext2mime(static::get_ext($filename));

		// Strip out encoding, if present.
		if (mb_strpos($mime, ';') !== false) {
			$mime = explode(';', $mime);
			$mime = $mime[0];
		}
		return $mime;
	}
public static function get_mime_type($filename) {
		if (extension_loaded('fileinfo')) {
			try {
				$finfo = new \finfo(FILEINFO_MIME_TYPE);
				return $finfo->file($filename);
			} catch (\Exception $e) {
				// Try next option...
			}
		}

		if (function_exists('mime_content_type')) {
			try {
				return mime_content_type($filename);
			} catch (\Exception $e) {
				// Try next option...
			}
		}

		$mime = \pdyn\filesystem\Mimetype::ext2mime(static::get_ext($filename));

		// Strip out encoding, if present.
		if (mb_strpos($mime, ';') !== false) {
			$mime = explode(';', $mime);
			$mime = $mime[0];
		}
		return $mime;
	}
public static function get_mime_type ( $ filename ) { if ( extension_loaded ( 'fileinfo' ) ) { try { $ finfo = new \ finfo ( FILEINFO_MIME_TYPE ) ; return $ finfo -> file ( $ filename ) ; } catch ( \ Exception $ e ) { // Try next option... } } if ( function_exists ( 'mime_content_type' ) ) { try { return mime_content_type ( $ filename ) ; } catch ( \ Exception $ e ) { // Try next option... } } $ mime = \ pdyn \ filesystem \ Mimetype :: ext2mime ( static :: get_ext ( $ filename ) ) ; // Strip out encoding, if present. if ( mb_strpos ( $ mime , ';' ) !== false ) { $ mime = explode ( ';' , $ mime ) ; $ mime = $ mime [ 0 ] ; } return $ mime ; }
Determine the mime-type of a file.

@param string $filename The full, absolute path to a file.
@return string The mime type.
Determine the mime - type of a file .