mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-05-19 12:06:29 -04:00
add format padding so that right align file size strings will line up nicely.
This commit is contained in:
@@ -2149,14 +2149,15 @@ function folder_size($dir) {
|
||||
} // end function folder_size
|
||||
|
||||
function human_filesize($size, $precision = 2) {
|
||||
$units = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
|
||||
$units = array('B ','kB','MB','GB','TB','PB','EB','ZB','YB');
|
||||
$step = 1024;
|
||||
$i = 0;
|
||||
while (($size / $step) > 0.9) {
|
||||
$size = $size / $step;
|
||||
$i++;
|
||||
}
|
||||
return round($size, $precision).$units[$i];
|
||||
# The idea is that we can right align this and have the digits columns line up nicely.
|
||||
return sprintf('%.'.$precision.'f', round($size, $precision)).$units[$i];
|
||||
}
|
||||
|
||||
function csrf_startup() {
|
||||
|
||||
Reference in New Issue
Block a user