add getSize function

This commit is contained in:
EA4GKQ 2016-06-28 16:33:17 +02:00 committed by GitHub
parent 4c6862add9
commit daa65b272f

View file

@ -459,6 +459,21 @@ function getActiveYSFReflectors($logLines) {
return $reflectorlist; return $reflectorlist;
} }
function getSize($filesize, $precision = 2)
{
$units = array('', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y');
foreach ($units as $idUnit => $unit)
{
if ($filesize > 1024)
$filesize /= 1024;
else
break;
}
return round($filesize, $precision).' '.$units[$idUnit].'B';
}
//Some basic inits //Some basic inits
$mmdvmconfigs = getMMDVMConfig(); $mmdvmconfigs = getMMDVMConfig();
$logLinesMMDVM = getMMDVMLog(); $logLinesMMDVM = getMMDVMLog();