function GDToolkit::getSupportedExtensions

Same name in other branches
  1. 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getSupportedExtensions()
  2. 10 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getSupportedExtensions()
  3. 11.x core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getSupportedExtensions()

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\ImageToolkit

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.