public function ImagemagickMimeTypeMapper::getExtensionsForMimeType in ImageMagick 8.2
Returns the appropriate extensions for a given MIME type.
Parameters
string $mimetype: A MIME type.
Return value
string[] An array of file extensions matching the MIME type, without leading dot.
Deprecated
in ImageMagick 8.x-2.4, will be removed in 8.x-3.0. Use FileEye\MimeMap\Type::getExtensions() instead.
See also
https://www.drupal.org/project/imagemagick/issues/3026733
File
- src/
ImagemagickMimeTypeMapper.php, line 83
Class
- ImagemagickMimeTypeMapper
- Maps MIME types to file extensions.
Namespace
Drupal\imagemagickCode
public function getExtensionsForMimeType($mimetype) {
@trigger_error(__METHOD__ . ' is deprecated in ImageMagick 8.x-2.4, will be removed in 8.x-3.0. Use FileEye\\MimeMap\\Type::getExtensions() instead. See https://www.drupal.org/project/imagemagick/issues/3026733.', E_USER_DEPRECATED);
$mapping = $this
->getMapping();
if (!in_array($mimetype, $mapping['mimetypes'])) {
return [];
}
$key = array_search($mimetype, $mapping['mimetypes']);
$extensions = array_keys($mapping['extensions'], $key, TRUE);
sort($extensions);
return $extensions;
}