use mime_content_type instead of getID3 + use proper MP4 mimetype

This commit is contained in:
Daku
2017-03-10 17:05:15 +00:00
parent 256d09a3ec
commit 84e86c4930
2 changed files with 31 additions and 41 deletions

View File

@@ -30,13 +30,11 @@ class MP3FileHandler extends DataHandlerExtension {
* @return Image|null
*/
protected function create_image_from_data($filename, $metadata) {
global $config;
$image = new Image();
// FIXME: need more flash format specs :|
$image->width = 0;
$image->height = 0;
//NOTE: No need to set width/height as we don't use it.
$image->width = 1;
$image->height = 1;
$image->filesize = $metadata['size'];
$image->hash = $metadata['hash'];
@@ -66,15 +64,15 @@ class MP3FileHandler extends DataHandlerExtension {
* @return bool
*/
protected function check_contents($file) {
$success = FALSE;
if (file_exists($file)) {
require_once('lib/getid3/getid3/getid3.php');
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($file, TRUE);
if (isset($ThisFileInfo['fileformat']) && $ThisFileInfo['fileformat'] == "mp3") {
return TRUE;
}
$mimeType = mime_content_type($file);
$success = ($mimeType == 'audio/mpeg');
}
return FALSE;
return $success;
}
}