You are here

function _emthumb_file_insert in Embedded Media Field 6.2

Same name and namespace in other branches
  1. 6.3 contrib/emthumb/emthumb.module \_emthumb_file_insert()
  2. 6 contrib/emthumb/emthumb.module \_emthumb_file_insert()

Insert a file into the database.

Parameters

$node: Node object file will be associated with.

$file: File to be inserted, passed by reference since fid should be attached. @TODO: use hook_file

1 call to _emthumb_file_insert()
_emthumb_file_update in contrib/emthumb/emthumb.module
update the file record if necessary

File

contrib/emthumb/emthumb.module, line 532
Allows for custom thumbnail overrides to Embedded Media Field.

Code

function _emthumb_file_insert($node, &$file, $field) {
  $field_name = $field['field_name'];
  $filepath = file_create_path($field['widget']['emimport_image_path']) . '/' . $file['filename'];
  $file = (object) $file;
  $status = file_set_status($file, 1);
  if (!$status) {

    // Include file name in upload error.
    drupal_set_message(t('Thumbnail upload (%filename) was unsuccessful.', array(
      '%filename' => $file['filename'],
    )), 'error');
    return FALSE;
  }
  $file = (array) $file;
}