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