color.install 1.32 KB
Newer Older
Steven Wittens's avatar
Steven Wittens committed
1 2
<?php

3 4 5 6 7
/**
 * @file
 * Install, update and uninstall functions for the color module.
 */

8 9 10
/**
 * Implements hook_requirements().
 */
Steven Wittens's avatar
Steven Wittens committed
11 12 13 14
function color_requirements($phase) {
  $requirements = array();

  if ($phase == 'runtime') {
15
    // Check for the PHP GD library.
Steven Wittens's avatar
Steven Wittens committed
16 17
    if (function_exists('imagegd2')) {
      $info = gd_info();
18
      $requirements['color_gd'] = array(
Steven Wittens's avatar
Steven Wittens committed
19 20 21
        'value' => $info['GD Version'],
      );

22
      // Check for PNG support.
23
      if (!function_exists('imagecreatefrompng')) {
24
        $requirements['color_gd']['severity'] = REQUIREMENT_WARNING;
25
        $requirements['color_gd']['description'] = t('The GD library for PHP is enabled, but was compiled without PNG support. Check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/ref.image.php'));
Steven Wittens's avatar
Steven Wittens committed
26 27 28
      }
    }
    else {
29
      $requirements['color_gd'] = array(
Steven Wittens's avatar
Steven Wittens committed
30 31
        'value' => t('Not installed'),
        'severity' => REQUIREMENT_ERROR,
32
        'description' => t('The GD library for PHP is missing or outdated. Check the <a href="@url">PHP image documentation</a> for information on how to correct this.', array('@url' => 'http://www.php.net/manual/book.image.php')),
Steven Wittens's avatar
Steven Wittens committed
33 34
      );
    }
35
    $requirements['color_gd']['title'] = t('GD library PNG support');
Steven Wittens's avatar
Steven Wittens committed
36 37 38 39
  }

  return $requirements;
}