1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 08:14:10 +00:00

Update PrettyNumber util

This commit is contained in:
Daniel Supernault 2022-02-05 19:02:57 -07:00
parent cd78560184
commit 0932b6e117
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -24,14 +24,13 @@ class PrettyNumber
return $number;
}
public static function size($expression, $kb = false)
public static function size($expression, $kb = false, $short = true)
{
if ($kb) {
$expression = $expression * 1024;
}
$size = intval($expression);
$precision = 0;
$short = true;
$units = $short ?
['B', 'k', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'] :
['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];