Passolution

This commit is contained in:
Kevin Adametz 2020-10-16 16:18:34 +02:00
parent f79806ffe8
commit 06fc3ba919
31 changed files with 337 additions and 119 deletions

View file

@ -289,5 +289,18 @@ class Util
return $content;
}
public static function _formatBytes($size, $precision = 2)
{
if ($size > 0) {
$size = (int) $size;
$base = log($size) / log(1024);
$suffixes = array(' bytes', ' KB', ' MB', ' GB', ' TB');
return round(pow(1024, $base - floor($base)), $precision) . $suffixes[floor($base)];
} else {
return $size;
}
}
}