Detect the MIME type of a file.
More...
Detect the MIME type of a file.
Definition at line 7 of file MimeTypeDetector.php.
Elgg\Filesystem\MimeTypeDetector::fixDetectionErrors |
( |
|
$type, |
|
|
|
$extension |
|
) |
| |
Fix common type detection errors.
- Parameters
-
string | $type | MIME type detected |
string | $extension | Filename extensions |
- Returns
- string Fixed MIME type
Definition at line 165 of file MimeTypeDetector.php.
Elgg\Filesystem\MimeTypeDetector::getType |
( |
|
$file, |
|
|
|
$default = self::DEFAULT_TYPE |
|
) |
| |
Sniff the MIME type.
- Parameters
-
string | $file | File path |
string | $default | Default type to return on failure |
- Returns
- string MIME type
Definition at line 118 of file MimeTypeDetector.php.
static Elgg\Filesystem\MimeTypeDetector::tryFile |
( |
|
$file | ) |
|
|
static |
Detect MIME type using file(1)
- Parameters
-
- Returns
- string Type detected. Empty string on failure
Definition at line 237 of file MimeTypeDetector.php.
static Elgg\Filesystem\MimeTypeDetector::tryFinfo |
( |
|
$file | ) |
|
|
static |
Detect MIME type using finfo_open.
- Parameters
-
- Returns
- string Type detected. Empty string on failure
Definition at line 203 of file MimeTypeDetector.php.
static Elgg\Filesystem\MimeTypeDetector::tryGetimagesize |
( |
|
$file | ) |
|
|
static |
Detect MIME type.
- Parameters
-
- Returns
- string Type detected. Empty string on failure
Definition at line 253 of file MimeTypeDetector.php.
static Elgg\Filesystem\MimeTypeDetector::tryMimeContentType |
( |
|
$file | ) |
|
|
static |
Detect MIME type using mime_content_type.
- Parameters
-
- Returns
- string Type detected. Empty string on failure
Definition at line 226 of file MimeTypeDetector.php.
Elgg\Filesystem\MimeTypeDetector::tryStrategies |
( |
|
$file | ) |
|
Detect MIME type using various strategies.
- Parameters
-
- Returns
- string Type detected. Empty string on failure
Definition at line 146 of file MimeTypeDetector.php.
Elgg\Filesystem\MimeTypeDetector::$extensions |
Elgg\Filesystem\MimeTypeDetector::$strategies |
Initial value:= [
[__CLASS__, 'tryFinfo'],
[__CLASS__, 'tryMimeContentType'],
[__CLASS__, 'tryFile'],
[__CLASS__, 'tryGetimagesize'],
]
Definition at line 14 of file MimeTypeDetector.php.
Elgg\Filesystem\MimeTypeDetector::$use_extension = true |
const Elgg\Filesystem\MimeTypeDetector::DEFAULT_TYPE = 'application/octet-stream' |
The documentation for this class was generated from the following file: