You are here

public function Todo2311679::getExtensionsForMimeType in ImageMagick 8

File

src/Todo2311679.php, line 17

Class

Todo2311679
Makes possible to guess the MIME type of a file using its extension.

Namespace

Drupal\imagemagick

Code

public function getExtensionsForMimeType($mimetype) {
  if ($this->mapping === NULL) {
    $mapping = $this->defaultMapping;

    // Allow modules to alter the default mapping.
    $this->moduleHandler
      ->alter('file_mimetype_mapping', $mapping);
    $this->mapping = $mapping;
  }
  if (!in_array($mimetype, $this->mapping['mimetypes'])) {
    return [];
  }
  $key = array_search($mimetype, $this->mapping['mimetypes']);
  $extensions = array_keys($this->mapping['extensions'], $key, TRUE);
  sort($extensions);
  return $extensions;
}