You are here

function image_effects_requirements in Image Effects 8

Same name and namespace in other branches
  1. 8.3 image_effects.install \image_effects_requirements()
  2. 8.2 image_effects.install \image_effects_requirements()

Implements hook_requirements().

File

./image_effects.install, line 11
Install, update and uninstall functions for the image_effects module.

Code

function image_effects_requirements($phase) {
  $requirements = [];

  // Check PHP EXIF extension for the auto_rotate image effect.
  $requirements['image_effects_exif_extension'] = [
    'title' => t('PHP EXIF extension'),
  ];
  if (!extension_loaded('exif')) {
    $requirements['image_effects_exif_extension'] += [
      'value' => t('Not installed'),
      'description' => t('The PHP EXIF extension is not installed. Automatic image orientation effects will not be available with the GD image toolkit.'),
      'severity' => REQUIREMENT_WARNING,
    ];
  }
  else {
    $requirements['image_effects_exif_extension'] += [
      'value' => t('Enabled'),
      'severity' => REQUIREMENT_INFO,
    ];
  }

  // Check PHP GD2 FreeType support.
  if (function_exists('gd_info')) {
    $info = gd_info();
    if (!function_exists('imagettftext') || !isset($info["FreeType Support"])) {

      // No FreeType support, raise warning.
      $requirements['image_effects_gd_freetype'] = [
        'title' => t('GD library FreeType support'),
        'value' => t('Not installed'),
        'severity' => REQUIREMENT_WARNING,
        'description' => t('The GD Library for PHP is enabled, but was compiled without FreeType support. Image effects using fonts will not be available with the GD image toolkit.'),
      ];
    }
  }
  return $requirements;
}