color.install 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the color module.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function color_requirements($phase) {
  10. $requirements = [];
  11. if ($phase == 'runtime') {
  12. // Check for the PHP GD library.
  13. if (function_exists('imagegd2')) {
  14. $info = gd_info();
  15. $requirements['color_gd'] = [
  16. 'value' => $info['GD Version'],
  17. ];
  18. // Check for PNG support.
  19. if (!function_exists('imagecreatefrompng')) {
  20. $requirements['color_gd']['severity'] = REQUIREMENT_WARNING;
  21. $requirements['color_gd']['description'] = t('The GD library for PHP is enabled, but was compiled without PNG support. Check the <a href="http://php.net/manual/ref.image.php">PHP image documentation</a> for information on how to correct this.');
  22. }
  23. }
  24. else {
  25. $requirements['color_gd'] = [
  26. 'value' => t('Not installed'),
  27. 'severity' => REQUIREMENT_ERROR,
  28. 'description' => t('The GD library for PHP is missing or outdated. Check the <a href="http://php.net/manual/book.image.php">PHP image documentation</a> for information on how to correct this.'),
  29. ];
  30. }
  31. $requirements['color_gd']['title'] = t('GD library PNG support');
  32. }
  33. return $requirements;
  34. }