You are here

function ctools_stylizer_image_processor::command_load in Chaos Tool Suite (ctools) 6

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

Create a new workspace a file.

This will make the new workspace the current workspace.

File

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

Class

ctools_stylizer_image_processor

Code

function command_load($name, $file) {
  $this
    ->log("New workspace: {$name} (from {$file})");
  if (!file_exists($file)) {

    // Try it relative to the plugin
    $file = $this->plugin['path'] . '/' . $file;
    if (!file_exists($file)) {
      $this
        ->log("Unable to open {$file}");
      return;
    }
  }

  // Clean up if there was already a workspace there.
  if (isset($this->workspaces[$name])) {
    imagedestroy($this->workspaces[$name]);
  }
  $this->workspaces[$name] = imagecreatefrompng($file);
  $this
    ->set_current_workspace($name);
}