You are here

function imce_add_file in IMCE 7

Same name and namespace in other branches
  1. 6.2 inc/imce.page.inc \imce_add_file()
  2. 6 inc/page.inc \imce_add_file()

Add a new file to the file list.

2 calls to imce_add_file()
imce_resize_image in inc/imce.page.inc
Resize an image in the file list. Also used for thumbnail creation.
imce_upload_submit in inc/imce.page.inc
Submit upload form.

File

inc/imce.page.inc, line 626
Implements the file browser.

Code

function imce_add_file($file, &$imce) {
  $imce['dirsize'] += $file->filesize;
  if (isset($imce['files'][$file->filename])) {
    $imce['dirsize'] -= $imce['files'][$file->filename]['size'];
  }
  $imce['files'][$file->filename] = array(
    'name' => $file->filename,
    'size' => $file->filesize,
    'width' => $file->width,
    'height' => $file->height,
    'date' => $file->timestamp,
  );
  if (isset($_GET['jsop'])) {
    $add = $imce['files'][$file->filename];
    $add['name'] = rawurlencode($file->filename);
    $add['fsize'] = format_size($file->filesize);
    $add['fdate'] = format_date($file->timestamp, 'short');
    $add['id'] = $file->fid;
    $imce['added'][] = $add;
  }
}