First off, looooove the module. Incredibly powerful. Saves me tons of grunt work. (And I love it even more in conjunction with imagecache_actions.)

I was slowly working my way through the API last night when I think I found some cruft that, while it doesn't add any bugs, probably doesn't need to be there. Happy to roll a patch if I am indeed correct.

Anyway, it looks like _imagecache_apply_action

function _imagecache_apply_action($action, $image) {
  $actions = imagecache_action_definitions();

  if ($definition = imagecache_action_definition($action['action'])) {
    $function = $action['action'] .'_image';
    if (function_exists($function)) {
      return $function($image, $action['data']);
    }
  }
  // skip undefined actions.. module probably got uninstalled or disabled.
  watchdog('imagecache', 'non-existant action %action', array('%action' => $action['action']), WATCHDOG_NOTICE);
  return TRUE;
}

could be tad simpler (as $actions and $definition are defined but never evaluated)

function _imagecache_apply_action($action, $image) {

  if (imagecache_action_definition($action['action'])) {
    $function = $action['action'] .'_image';
    if (function_exists($function)) {
      return $function($image, $action['data']);
    }
  }
  // skip undefined actions.. module probably got uninstalled or disabled.
  watchdog('imagecache', 'non-existant action %action', array('%action' => $action['action']), WATCHDOG_NOTICE);
  return TRUE;
}

Comments

fizk’s picture

Status: Active » Closed (fixed)

Committed. Thanks!