You are here

function photos_image_date in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.module \photos_image_date()
3 calls to photos_image_date()
photos_swfu_upload in photos_swfu/photos_swfu.module
photos_upload_form_submit in inc/photos.edit.inc
_photos_unzip in ./photos.module

File

./photos.module, line 1036

Code

function photos_image_date($file, $title = 0) {
  $exif = $file->filemime == 'image/jpeg' ? 1 : 0;
  if ($file->fid && $file->pid && db_query("INSERT INTO {x_image} (fid, pid, des, wid, comcount, count, exif) VALUES (%d, %d, '%s', %d, 0, 0, %d)", $file->fid, $file->pid, $file->des, $file->wid, $exif)) {
    if (!variable_get('photos_thumb_create_time', 0)) {
      photos_image_crop(array(
        'path' => $file->filepath,
        'fid' => $file->fid,
      ));
    }
    if ($file->nid) {
      db_query('INSERT INTO {x_node} (nid, fid) VALUES (%d, %d)', $file->nid, $file->fid);
    }
    if (variable_get('photos_user_count_cron', 1)) {
      photos_set_count('user_image', $file->uid ? $file->uid : $GLOBALS['user']->uid);
      photos_set_count('node_album', $file->pid);
      $file->nid ? photos_set_count('node_node', $file->nid) : NULL;
    }
    if ($title) {
      db_query("UPDATE {files} SET status = 1, filename = '%s' WHERE fid = %d", $file->title, $file->fid);
    }
    return true;
  }
  else {
    return false;
  }
}