public static function GDToolkit::getSupportedExtensions in Drupal 8
Same name and namespace in other branches
- 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getSupportedExtensions()
Returns a list of image file extensions supported by the toolkit.
Return value
array An array of supported image file extensions (e.g. png/jpeg/gif).
Overrides ImageToolkitInterface::getSupportedExtensions
File
- core/
modules/ system/ src/ Plugin/ ImageToolkit/ GDToolkit.php, line 416
Class
- GDToolkit
- Defines the GD2 toolkit for image manipulation within Drupal.
Namespace
Drupal\system\Plugin\ImageToolkitCode
public static function getSupportedExtensions() {
$extensions = [];
foreach (static::supportedTypes() as $image_type) {
// @todo Automatically fetch possible extensions for each mime type.
// @see https://www.drupal.org/node/2311679
$extension = mb_strtolower(image_type_to_extension($image_type, FALSE));
$extensions[] = $extension;
// Add some known similar extensions.
if ($extension === 'jpeg') {
$extensions[] = 'jpg';
$extensions[] = 'jpe';
}
}
return $extensions;
}