mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-09-18 19:54:42 -04:00
Switch from binary bytes to SI-units
This commit is contained in:
parent
67e4eb74ed
commit
863cb89ad9
43 changed files with 46 additions and 342 deletions
|
@ -59,10 +59,10 @@ class Filter
|
|||
*/
|
||||
public static function formatHumanReadableSize($size)
|
||||
{
|
||||
$iec = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
|
||||
$iec = array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||
$i = 0;
|
||||
while (($size / 1024) >= 1) {
|
||||
$size = $size / 1024;
|
||||
while (($size / 1000) >= 1) {
|
||||
$size = $size / 1000;
|
||||
++$i;
|
||||
}
|
||||
return number_format($size, $i ? 2 : 0, '.', ' ') . ' ' . I18n::_($iec[$i]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue