You are here

function imageeditor_sumopaint_save_callback in Image Editor 7

1 string reference to 'imageeditor_sumopaint_save_callback'
sumopaint.inc in plugins/editor/sumopaint/sumopaint.inc
Sumopaint editor for Image Editor module.

File

plugins/editor/sumopaint/sumopaint.inc, line 37
Sumopaint editor for Image Editor module.

Code

function imageeditor_sumopaint_save_callback() {
  $directory = imageeditor_temporary_directory();
  $image = '';
  if (isset($_POST['data'])) {
    if ($_POST['url']) {
      $destination = $directory . '/' . basename($_POST['url']);
    }
    else {
      $destination = $directory . '/' . md5($_POST['data']) . '.png';
    }
    $file = file_unmanaged_save_data(base64_decode($_POST['data']), $destination);
    $image = file_create_url($file);
  }
  $js_code = 'if (opener) {';
  $js_code .= 'opener.Drupal.settings.imageeditor.save.image = "' . $image . '";';
  $js_code .= 'opener.Drupal.imageeditor.save();';
  $js_code .= 'self.close();';
  $js_code .= '}';
  drupal_add_js($js_code, 'inline');
}