Browse Source

Merge pull request #347 from nhart/7.x

7.x
pull/321/merge
Adam 11 years ago
parent
commit
0de2f61a4b
  1. 10
      includes/mime_detect.inc
  2. 17
      islandora.module

10
includes/mime_detect.inc

@ -372,4 +372,14 @@ class MimeDetect {
return $out; return $out;
} }
/**
* Gets MIME type array.
*
* @return array
* Returns associative array with exts and mimetypes.
*/
public function getMimeTypes() {
return $this->protectedMimeTypes;
}
} }

17
islandora.module

@ -1109,3 +1109,20 @@ function islandora_download_clip(AbstractObject $object) {
} }
exit(); exit();
} }
/**
* Implements hook_file_mimetype_mapping_alter().
*
* Grab custom islandora mime type list
* and add any missing ext/mimes to the drupal mapping
*/
function islandora_file_mimetype_mapping_alter(&$mapping) {
$mime_detect = new MimeDetect();
$types = $mime_detect->getMimeTypes();
$diff = array_diff_key($types, $mapping['extensions']);
foreach ($diff as $ext => $mime) {
$mapping['mimetypes'][] = $mime;
end($mapping['mimetypes']);
$mapping['extensions'][$ext] = key($mapping['mimetypes']);
}
}

Loading…
Cancel
Save