You are here

function imageeditor_paintweb_save_callback in Image Editor 7

1 string reference to 'imageeditor_paintweb_save_callback'
paintweb.inc in plugins/editor/paintweb/paintweb.inc
Paintweb editor for Image Editor module.

File

plugins/editor/paintweb/paintweb.inc, line 37
Paintweb editor for Image Editor module.

Code

function imageeditor_paintweb_save_callback() {
  $directory = imageeditor_temporary_directory();
  if (isset($_POST['data'])) {
    if ($_POST['url'] && $_POST['url'] != 'undefined') {
      $destination = $directory . '/' . basename($_POST['url']);
    }
    else {
      $destination = $directory . '/' . md5($_POST['data']) . '.png';
    }
    list(, $data) = explode(',', $_POST['data']);
    $file = file_unmanaged_save_data(base64_decode($data), $destination);
    drupal_json_output(file_create_url($file));
    drupal_exit();
  }
}