You are here

function hook_imagecache_external_needs_refresh_alter in Imagecache External 8

Same name and namespace in other branches
  1. 7.2 imagecache_external.api.php \hook_imagecache_external_needs_refresh_alter()

Add custom image refresh logic.

Use this hook to add extra validation(s) whether to refresh images.

1 function implements hook_imagecache_external_needs_refresh_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

imagecache_external_imagecache_external_needs_refresh_alter in ./imagecache_external.module
Implements hook_imagecache_external_needs_refresh_alter().
1 invocation of hook_imagecache_external_needs_refresh_alter()
imagecache_external_generate_path in ./imagecache_external.module
Util to generate a path to an image.

File

./imagecache_external.api.php, line 13
Documentation of Imagecache External hooks.

Code

function hook_imagecache_external_needs_refresh_alter(&$needs_refresh, $filepath) {

  // Example: refresh images at least once a week.
  if (filemtime($filepath) > \Drupal::time()
    ->getRequestTime() - 60 * 60 * 24 * 7) {
    $needs_refresh = TRUE;
  }
}