You are here

public function GDToolkit::getRequirements in Zircon Profile 8

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

Gets toolkit requirements in a format suitable for hook_requirements().

Return value

array An associative requirements array as is returned by hook_requirements(). If the toolkit claims no requirements to the system, returns an empty array. The array can have arbitrary keys and they do not have to be prefixed by e.g. the module name or toolkit ID, as the system will make the keys globally unique.

Overrides ImageToolkitBase::getRequirements

See also

hook_requirements()

File

core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php, line 369
Contains \Drupal\system\Plugin\ImageToolkit\GDToolkit.

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function getRequirements() {
  $requirements = array();
  $info = gd_info();
  $requirements['version'] = array(
    '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=":url">the PHP manual</a>.', array(
      ':url' => 'http://www.php.net/manual/book.image.php',
    ));
  }
  return $requirements;
}