You are here

function imagecache_image_alter in ImageCache 5.2

Implementation of hook_image_alter()

Capture the image_build_derivatives phase of image.module and insert our own manipulations to it any time an image is manipulated.

This runs the imagecache builder over the input file and places it in the output destination.

File

./imagecache_image.module, line 79
Provide Integration for the image.module and imagecache.

Code

function imagecache_image_alter($node, $destination, $sizename) {
  $sizes = image_get_sizes();
  $size_def = $sizes[$sizename];

  // Appended to the dimensions is our 'imagecache' id value. Maybe.
  if ($presetid = $size_def['imagecache']) {
    $original = file_create_path($node->images['_original']);
    $preset = imagecache_preset($presetid);
    $result = imagecache_build_derivative($preset['actions'], $original, $destination);
  }
}