imagefield_file_update

Versions
5
imagefield_file_update($node, &$file, $field)

Update the file record if necessary.

Parameters

$node Node object this file is be associated with.

$file A single CCK image field item to be updated.

$field The field definition for this image field.

Code

contributions/imagefield/imagefield.module, line 279

<?php
function imagefield_file_update($node, &$file, $field) {
  $file = (array)$file;
  if ($file['flags']['delete'] == true) {
    // don't delete files if we're creating new revisions, but still return an empty
    // array...
    if ($node->old_vid || _imagefield_file_delete($file, $field['field_name'])) {
      return array();
    }
  }
  if ($file['fid'] == 'upload') {
    return imagefield_file_insert($node, $file, $field);
  }
  else {
    // empty files without fid.
    if ($file['fid'] == 0) {
      $file = array();
    }
    // if fid is not numeric here we should complain.
    // else we update the file table.
  }
  return $file;
}
?>

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters (without spaces) shown in the image.