public function ImagemagickFormatMapper::getFormatFromExtension in ImageMagick 8.2
Same name and namespace in other branches
- 8.3 src/ImagemagickFormatMapper.php \Drupal\imagemagick\ImagemagickFormatMapper::getFormatFromExtension()
- 8 src/ImagemagickFormatMapper.php \Drupal\imagemagick\ImagemagickFormatMapper::getFormatFromExtension()
Gets the image format, given the image file extension.
Parameters
string $extension: An image file extension (e.g. jpeg, jpg, png, etc.), without leading dot.
Return value
string|null The ImageMagick internal format (e.g. JPEG, GIF87, etc.) of the specified extension, if the format is enabled in the toolkit. NULL otherwise.
Overrides ImagemagickFormatMapperInterface::getFormatFromExtension
File
- src/
ImagemagickFormatMapper.php, line 149
Class
- ImagemagickFormatMapper
- Provides the ImageMagick format mapper.
Namespace
Drupal\imagemagickCode
public function getFormatFromExtension($extension) {
$extension = Unicode::strtolower($extension);
$enabled_extensions = $this
->resolveEnabledExtensions();
return $extension ? isset($enabled_extensions[$extension]) ? $enabled_extensions[$extension] : NULL : NULL;
}