mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
handle special case size=1 in format_filesize()
This commit is contained in:
parent
7bac4e730e
commit
790eef7e84
|
@ -84,8 +84,9 @@ class SeedDMS_Core_File {
|
|||
*/
|
||||
static function format_filesize($size, $sizes = array('Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB')) { /* {{{ */
|
||||
if ($size == 0) return('0 Bytes');
|
||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
if ($size == 1) return('1 Byte');
|
||||
/** @noinspection PhpIllegalArrayKeyTypeInspection */
|
||||
return (round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user