Merge pull request #13 from assertchris/use-symfony-mime-type-detection

Using Symfony mime type detection
This commit is contained in:
Damian Mooyman 2015-05-14 11:33:04 +12:00
commit 9b36af2791
2 changed files with 5 additions and 6 deletions

View File

@ -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();
}
/**

View File

@ -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"