You are here

function imagepicker_get_all_bytes in Image Picker 5.2

Same name and namespace in other branches
  1. 6.2 imagepicker.functions.inc \imagepicker_get_all_bytes()
  2. 7 imagepicker.functions.inc \imagepicker_get_all_bytes()
3 calls to imagepicker_get_all_bytes()
imagepicker_admin_images in ./imagepicker.module
imagepicker_group_stats in ./imagepicker.module
statistics
imagepicker_quota_ok in ./imagepicker.module

File

./imagepicker.module, line 4171
Enables permitted roles to upload images for insertion into configured nodes.

Code

function imagepicker_get_all_bytes($account = FALSE) {
  $tot = 0;
  $olduid = 0;
  $sql = 'SELECT img_id, uid FROM {imagepicker} ';
  if (is_object($account)) {
    $sql .= 'WHERE uid = ' . $account->uid;
    $user = $account;
  }
  elseif ($account == -1) {
    global $user;
    $sql .= 'WHERE uid = ' . $user->uid;
  }
  $result = db_query($sql);
  while ($row = db_fetch_array($result)) {
    if (!$account && $olduid != $row['uid']) {
      $user = user_load(array(
        'uid' => $row['uid'],
      ));
    }
    $tot += _imagepicker_get_bytes($row['img_id'], $user);
    $olduid = $row['uid'];
  }
  return $tot;
}