Filelist should use IEC prefixes and appropriate units for filesize.
The filelist shows filesizes a bit weird using an inappropriate SI prefix - it don't even uses a unit.
124 Byte (now "124") should be "123 B"
1.428.278 Byte (now "1.4 M") should be "1.36 MiB (1.42 MB)"
1.150 Byte (now "1.1 K") should be "1.12 KiB (1.15 KB)"
(issue imported from #M13645)
[!!!][FEATURE] Support IEC/SI units in file size formatting
The new labels "iec" and "si" are added to GeneralUtility::formatSize,
where "iec" is the new default label.
A new parameter "base" has been added for specifying the base unit
multiplier expecting 1000 and 1024 as value and defaulting to 1024
when using the old labels.
Reviewed-by: Alexander Opitz <firstname.lastname@example.org>
Tested-by: Alexander Opitz <email@example.com>
Reviewed-by: Christian Kuhn <firstname.lastname@example.org>
Tested-by: Christian Kuhn <email@example.com>
#1 Updated by Sigfried Arnold over 10 years ago
I refactored the code, made it more flexible and added the corrections.
The code is fully backwards compatible but is more scaleable (till inifinity) - but i just wanted to respect the dry-principle ;)
I tested the code with TYPO3 4.2, 4.3 and 4.4 alpha - everything seems to be fine.
The essential part ist now shorter, the function itself is only a few bytes larger - excluding the comments < 100 byte.
Possibly todo (additional feature): the make the default lables and calculation base configurable via localconf.
Ready to bring it into the trunk.
#3 Updated by Alexander Opitz over 6 years ago
- Status changed from New to Needs Feedback
- Target version deleted (
- TYPO3 Version set to 4.3
as this issue is very old. Is this feature missing in newer versions of TYPO3 CMS (6.1.7)?
If yes, can you provide a newer patch against master by using Gerrit? http://wiki.typo3.org/CWT
#22 Updated by Sigfried Arnold almost 5 years ago
Pierrick Caillon wrote:
The formatting rules in http://physics.nist.gov/cuu/Units/checklist.html are used. Especially the number 15 applying to spacing.
I was not talking about the spacing or the formatting, i was talking about the missing unit symbol :) currently there is just a prefix with no unit
It should be 100 MiB or 200 kB - not just 100 Mi or 200 k - the unit symbol is mandatory, else it could be "anything" - it is pretty obvious that those are Bytes, but it does not say so.
To fix this: "B" needs to be appended to each Prefix since it cannot stand there alone.