public function ExtensionMimeTypeGuesser::convertMimeTypeToExtension in FileField Sources 8
Same name in this branch
- 8 src/File/MimeType/ExtensionMimeTypeGuesser.php \Drupal\filefield_sources\File\MimeType\ExtensionMimeTypeGuesser::convertMimeTypeToExtension()
- 8 src/ProxyClass/File/MimeType/ExtensionMimeTypeGuesser.php \Drupal\filefield_sources\ProxyClass\File\MimeType\ExtensionMimeTypeGuesser::convertMimeTypeToExtension()
Convert mime type to extension.
Parameters
string $mimetype: Mime type.
Return value
string|bool Return extension if found, FALSE otherwise.
File
- src/
File/ MimeType/ ExtensionMimeTypeGuesser.php, line 21
Class
- ExtensionMimeTypeGuesser
- Add methods to core guesser.
Namespace
Drupal\filefield_sources\File\MimeTypeCode
public function convertMimeTypeToExtension($mimetype) {
$this
->checkDefaultMapping();
$mime_key = array_search($mimetype, $this->mapping['mimetypes']);
$extension = array_search($mime_key, $this->mapping['extensions']);
return $extension;
}