show maximagesize warning in a human readable format
This commit is contained in:
parent
e0f6bd6c28
commit
a982320ba9
5 changed files with 17 additions and 5 deletions
|
@ -1013,3 +1013,15 @@ function store_photo($a, $uid, $imagedata = "", $url = "") {
|
|||
|
||||
return($image);
|
||||
}
|
||||
|
||||
function formatBytes($bytes, $precision = 2) {
|
||||
$units = array('B', 'KB', 'MB', 'GB', 'TB');
|
||||
|
||||
$bytes = max($bytes, 0);
|
||||
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
|
||||
$pow = min($pow, count($units) - 1);
|
||||
|
||||
$bytes /= pow(1024, $pow);
|
||||
|
||||
return round($bytes, $precision) . ' ' . $units[$pow];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue