You are here

function filedepot_formatFileSize in filedepot 7

Same name and namespace in other branches
  1. 6 lib-common.php \filedepot_formatFileSize()
5 calls to filedepot_formatFileSize()
filedepotAjaxServer_loadFileDetails in ./lib-ajaxserver.php
template_preprocess_filedepot_activefolder_admin in ./lib-theme.php
template_preprocess_filedepot_filedetail in ./lib-theme.php
template_preprocess_filedepot_filelisting in ./lib-theme.php
template_preprocess_filedepot_fileversion in ./lib-theme.php

File

./lib-common.php, line 265
lib-common.php Common library of functions for the applications

Code

function filedepot_formatFileSize($size) {
  $size = intval($size);
  if ($size / 1000000 > 1) {
    $size = round($size / 1000000, 2) . " MB";
  }
  elseif ($size / 1000 > 1) {
    $size = round($size / 1000, 2) . " KB";
  }
  else {
    $size = round($size, 2) . " Bytes";
  }
  return $size;
}