You are here

public function GDToolkit::getRequirements in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getRequirements()
  2. 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getRequirements()

File

core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php, line 374

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function getRequirements() {
  $requirements = [];
  $info = gd_info();
  $requirements['version'] = [
    'title' => t('GD library'),
    'value' => $info['GD Version'],
  ];

  // Check for filter and rotate support.
  if (!function_exists('imagefilter') || !function_exists('imagerotate')) {
    $requirements['version']['severity'] = REQUIREMENT_WARNING;
    $requirements['version']['description'] = t('The GD Library for PHP is enabled, but was compiled without support for functions used by the rotate and desaturate effects. It was probably compiled using the official GD libraries from http://www.libgd.org instead of the GD library bundled with PHP. You should recompile PHP --with-gd using the bundled GD library. See <a href="http://php.net/manual/book.image.php">the PHP manual</a>.');
  }
  return $requirements;
}