Notice Error. #252

This commit is contained in:
Prasath Mani 2019-11-15 12:21:31 +05:30
parent 4a8bd014af
commit bf8b715c13

View file

@ -2244,9 +2244,17 @@ function fm_get_size($file)
*/
function fm_get_filesize($size)
{
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
$power = $size > 0 ? floor(log($size, 1024)) : 0;
return sprintf('%s %s', round($size / pow(1024, $power), 2), $units[$power]);
if ($size < 1000) {
return sprintf('%s B', $size);
} elseif (($size / 1024) < 1000) {
return sprintf('%s KB', round(($size / 1024), 2));
} elseif (($size / 1024 / 1024) < 1000) {
return sprintf('%s MB', round(($size / 1024 / 1024), 2));
} elseif (($size / 1024 / 1024 / 1024) < 1000) {
return sprintf('%s GB', round(($size / 1024 / 1024 / 1024), 2));
} else {
return sprintf('%s TB', round(($size / 1024 / 1024 / 1024 / 1024), 2));
}
}
/**