You are here

function ctools_stylizer_image_processor::execute in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 includes/stylizer.inc \ctools_stylizer_image_processor::execute()

File

includes/stylizer.inc, line 243
Create customized CSS and images from palettes created by user input.

Class

ctools_stylizer_image_processor

Code

function execute($path, $plugin, $settings) {
  $this->path = $path;
  $this->plugin = $plugin;
  $this->settings = $settings;
  $this->palette = $settings['palette'];
  if (is_string($plugin['actions']) && function_exists($plugin['actions'])) {
    $actions = $plugin['actions']($plugin, $settings);
  }
  elseif (is_array($plugin['actions'])) {
    $actions = $plugin['actions'];
  }
  if (!empty($actions) && is_array($actions)) {
    foreach ($plugin['actions'] as $action) {
      $command = 'command_' . array_shift($action);
      if (method_exists($this, $command)) {
        call_user_func_array(array(
          $this,
          $command,
        ), $action);
      }
    }
  }

  // Clean up buffers.
  foreach ($this->workspaces as $name => $workspace) {
    imagedestroy($this->workspaces[$name]);
  }
}