You are here

function _imagepicker_bkmg in Image Picker 5.2

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

File

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

Code

function _imagepicker_bkmg($number) {
  $inc = 1000;
  $count = 1000;
  $symarr = array(
    'K',
    'M',
    'G',
    'T',
  );
  $sym = 'B';
  while ($number > $count) {
    $count = $count * $inc;
    $sym = array_shift($symarr);
  }
  if ($number < $inc) {
    return $number . ' ' . $sym;
  }
  return round($number / $count * $inc, 2) . ' ' . $sym;
}