You are here

imageapi_optimize_gd.install in ImageAPI Optimize GD 8

Same filename and directory in other branches
  1. 2.x imageapi_optimize_gd.install

File

imageapi_optimize_gd.install
View source
<?php

/**
 * Add a requirement that PHP is compiled with the GD library.
 *
 * @param $phase
 *
 * @return array
 */
function imageapi_optimize_gd_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {
    $requirements['imageapi_optimize_gd'] = [
      'title' => t('ImageAPI Optimize GD'),
      'severity' => REQUIREMENT_INFO,
    ];
    if (function_exists('imagegd2')) {
      $requirements['imageapi_optimize_gd']['description'] = t('The GD Library for PHP is enabled.');
      $requirements['imageapi_optimize_gd']['severity'] = REQUIREMENT_OK;
    }
    else {
      $requirements['imageapi_optimize_gd']['description'] = t('The GD Library for PHP is not enabled, please recompile PHP with GD enabled.');
      $requirements['imageapi_optimize_gd']['severity'] = REQUIREMENT_WARNING;
    }
  }
  return $requirements;
}

Functions

Namesort descending Description
imageapi_optimize_gd_requirements Add a requirement that PHP is compiled with the GD library.