From 68e565889d2e019b67d4e00a03076ec042bcf5ff Mon Sep 17 00:00:00 2001 From: rabuzarus <> Date: Mon, 29 Jun 2015 11:22:29 +0200 Subject: [PATCH] moved formatBytes() to /include/text.php --- include/Photo.php | 11 ----------- include/text.php | 12 ++++++++++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/include/Photo.php b/include/Photo.php index 0adc55258b..785601c7e4 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -1014,14 +1014,3 @@ 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]; -} diff --git a/include/text.php b/include/text.php index 5c6ab588f1..829e37c2ce 100644 --- a/include/text.php +++ b/include/text.php @@ -2282,3 +2282,15 @@ function deindent($text, $chr="[\t ]", $count=NULL) { return implode("\n", $lines); } + +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]; +}