image_module_test.module 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @file
  4. * Provides Image module hook implementations for testing purposes.
  5. */
  6. function image_module_test_file_download($uri) {
  7. if (variable_get('image_module_test_file_download', FALSE) == $uri) {
  8. return array('X-Image-Owned-By' => 'image_module_test');
  9. }
  10. if (variable_get('image_module_test_invalid_headers', FALSE) == $uri) {
  11. return array('Content-Type' => 'image/png');
  12. }
  13. }
  14. /**
  15. * Implements hook_image_effect_info().
  16. */
  17. function image_module_test_image_effect_info() {
  18. $effects = array(
  19. 'image_module_test_null' => array(
  20. 'effect callback' => 'image_module_test_null_effect',
  21. ),
  22. );
  23. return $effects;
  24. }
  25. /**
  26. * Image effect callback; Null.
  27. *
  28. * @param $image
  29. * An image object returned by image_load().
  30. * @param $data
  31. * An array with no attributes.
  32. *
  33. * @return
  34. * TRUE
  35. */
  36. function image_module_test_null_effect(array &$image, array $data) {
  37. return TRUE;
  38. }
  39. /**
  40. * Implements hook_image_effect_info_alter().
  41. *
  42. * Used to keep a count of cache misses in image_effect_definitions().
  43. */
  44. function image_module_test_image_effect_info_alter(&$effects) {
  45. $image_effects_definition_called = &drupal_static(__FUNCTION__, 0);
  46. $image_effects_definition_called++;
  47. }