From: Michael M Slusarz Date: Mon, 19 Jan 2009 22:57:57 +0000 (-0700) Subject: Finally, size display should be working correctly X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=106011eb7c5817f9d7b57c0c1f3ab1fadd84a1a4;p=horde.git Finally, size display should be working correctly --- diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index caf1f8efe..57ccfc228 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -517,7 +517,7 @@ class IMP_Contents if (($mask & self::SUMMARY_BYTES) || $download_zip || ($mask & self::SUMMARY_SIZE)) { - $part['bytes'] = $mime_part->getBytes(); + $part['bytes'] = $size = $mime_part->getBytes(); if ($part['bytes'] && ($mime_part->getCurrentEncoding() == 'base64')) { @@ -525,13 +525,12 @@ class IMP_Contents * only about 33 percent larger than the unencoded data." * Thus, adding 33% to the byte size is a good estimate for * our purposes. */ - $size = number_format(max((($part['bytes'] * 0.75) / 1024), 1)); - } else { - $size = $mime_part->getSize(true); + $size *= 1.33; } - $part['size'] = ($size > 1024) - ? sprintf(_("%s MB"), number_format(max(($size / 1024)))) - : sprintf(_("%s KB"), max(round($size), 1)); + + $part['size'] = ($size > 1048576) + ? sprintf(_("%s MB"), number_format($size / 1048576, 1)) + : sprintf(_("%s KB"), max(round($size / 1024), 1)); } /* Get part's icon. */