You are here

function textimage_requirements in Textimage 6.2

Same name and namespace in other branches
  1. 5.2 textimage.install \textimage_requirements()
  2. 7.3 textimage.install \textimage_requirements()
  3. 7.2 textimage.install \textimage_requirements()

Implementation of hook_requirements().

File

./textimage.install, line 10

Code

function textimage_requirements($phase) {

  // Ensure translations don't break at install time
  $t = get_t();
  $requirements['textimage_gd'] = array(
    'title' => $t('GD library'),
  );
  if (function_exists('imagegd2')) {
    $info = gd_info();
    $requirements['textimage_gd']['value'] = $info['GD Version'];

    // Check FreeType support
    if (function_exists('imagettftext') && $info["FreeType Support"]) {
      if (!module_exists('color') && !module_exists('imageapi_gd')) {
        $requirements['textimage_gd']['severity'] = REQUIREMENT_OK;
      }
      else {
        $requirements = array();
      }
    }
    else {
      $requirements['textimage_gd']['severity'] = REQUIREMENT_ERROR;
      $requirements['textimage_gd']['description'] = $t('The GD library for PHP is enabled, but was compiled without FreeType support. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array(
        '@url' => 'http://www.php.net/manual/en/ref.image.php',
      ));
    }
  }
  else {
    $requirements['textimage_gd'] = array(
      'value' => $t('Not installed'),
      'severity' => REQUIREMENT_ERROR,
      'description' => $t('The GD library for PHP is missing or outdated. Please check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array(
        '@url' => 'http://www.php.net/manual/en/image.setup.php',
      )),
    );
  }
  return $requirements;
}