You are here

function bynder_upload_file_batch in Bynder 7

1 string reference to 'bynder_upload_file_batch'
bynder_upload_submit in includes/bynder_upload.inc

File

includes/bynder_upload.inc, line 136

Code

function bynder_upload_file_batch($file, &$context) {

  // update message during each run so you know where you are in the process
  $context['message'] = 'Now processing image with name ' . $file->filename;
  $file = file_load($file->fid);
  $data = array(
    'filePath' => drupal_realpath($file->uri),
    'brandId' => variable_get('bynder_brand_selected'),
    'name' => $file->filename,
    'description' => 'Image description',
    'audit' => variable_get('bynder_upload_method') == 'upload' ? false : true,
  );
  $fileInfo = BynderMediaApi::getBynderApi()
    ->uploadFile($data);
  $context['results']['to_delete'] = $file;
  $context['results']['uploaded_file'] = $fileInfo;
}