You are here

function imageeditor_save in Image Editor 7

Same name and namespace in other branches
  1. 6 imageeditor.module \imageeditor_save()

AJAX callback to save the image.

1 string reference to 'imageeditor_save'
imageeditor_menu in ./imageeditor.module
Implements hook_menu().

File

./imageeditor.pages.inc, line 10
Different pages for Image Editor module.

Code

function imageeditor_save($codename) {
  $plugin = imageeditor_info('editor', $codename);

  // Prepare temporary directory.
  $directory = imageeditor_temporary_directory();
  if (!file_prepare_directory($directory, FILE_CREATE_DIRECTORY)) {
    watchdog('imageeditor', 'Directory %directory could not be created.', array(
      '%directory' => $directory,
    ), WATCHDOG_WARNING);
    drupal_json_output('There was an error saving your image. Please contact site administrator.');
    drupal_exit();
  }

  // Process image per service.
  if ($function = ctools_plugin_get_function($plugin, 'save_callback')) {
    $function();
  }
  return '';
}