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