Fixed returnBytes function return correct amount of bytes

pull/10/merge
thomasmars 2017-05-29 11:18:12 +02:00
parent 0ce7d66c3a
commit fa31c56dce
1 changed files with 7 additions and 5 deletions

View File

@ -2969,18 +2969,20 @@ class H5PCore {
* @return int|string
*/
public static function returnBytes($val) {
$val = (int) trim($val);
$val = trim($val);
$last = strtolower($val[strlen($val) - 1]);
$bytes = (int) $val;
switch ($last) {
case 'g':
$val *= 1024;
$bytes *= 1024;
case 'm':
$val *= 1024;
$bytes *= 1024;
case 'k':
$val *= 1024;
$bytes *= 1024;
}
return $val;
return $bytes;
}
/**