You are here

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

Same name and namespace in other branches
  1. 6 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 318
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);
}