mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 11:06:00 +02:00
Using Symfony mime type detection
This commit is contained in:
parent
fd917f04a1
commit
fbc31692e7
@ -63,11 +63,9 @@ abstract class FileTextExtractor extends Object {
|
||||
* @return string Mime type if found
|
||||
*/
|
||||
protected static function get_mime($path) {
|
||||
if(!class_exists('finfo')) return null;
|
||||
$file = new Symfony\Component\HttpFoundation\File\File($path);
|
||||
|
||||
// Check mime of file
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
return $finfo->file($path);
|
||||
return $file->getMimeType();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,10 +20,11 @@
|
||||
"composer/installers": "*",
|
||||
"silverstripe/framework": "~3.1",
|
||||
"guzzle/guzzle": "~3.9",
|
||||
"symfony/event-dispatcher": "~2.6.0@stable"
|
||||
"symfony/event-dispatcher": "~2.6.0@stable",
|
||||
"symfony/http-foundation": "~2.6.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/PHPUnit": "~3.7@stable"
|
||||
"phpunit/phpunit": "~3.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-fileinfo": "Improved support for file mime detection"
|
||||
|
Loading…
Reference in New Issue
Block a user