You are here

function imageeditor_ribbet_save_callback in Image Editor 7

1 string reference to 'imageeditor_ribbet_save_callback'
ribbet.inc in plugins/editor/ribbet/ribbet.inc
Ribbet editor for Image Editor module.

File

plugins/editor/ribbet/ribbet.inc, line 37
Ribbet editor for Image Editor module.

Code

function imageeditor_ribbet_save_callback() {
  $image = '';
  if (isset($_GET['file'])) {
    $directory = imageeditor_temporary_directory();
    $data = drupal_http_request(rawurldecode($_GET['file']));
    $destination = $directory . '/' . $_GET['title'] . '.' . $_GET['type'];
    $file = file_unmanaged_save_data($data->data, $destination, FILE_EXISTS_REPLACE);
    $image = file_create_url($file);
  }
  $js_code = 'if (parent) {';
  $js_code .= 'parent.Drupal.settings.imageeditor.save.image = "' . $image . '";';
  $js_code .= 'parent.Drupal.imageeditor.save();';
  $js_code .= 'parent.Drupal.imageeditor.overlay.hide();';
  $js_code .= '}';
  drupal_add_js($js_code, 'inline');
}