I have been using the
%_file_size% value to automatically display KB, MB or GB units depending on the file size.
It works fine, but the units seem to switch based upon binary values instead of decimal values (i.e. 1024 instead of 1000). Using binary values for file sizes makes sense because it's what most people would want and expect for such a value, but the units really should be displayed as KiB, MiB, and GiB and not KB, MB and GB (which are decimal units).
In my case, I want to limit the number of displayed characters to no more than 3 digits and 2 decimal places (plus the 2 letters for the unit size) but
%_file_size% does not allow me to do this.
I would therefore like to recreate the same automatic unit-changing ability of the
%_file_size% value, but with the changes occurring at 1000 instead of 1024 (so that 999.99 is the highest value to be displayed before switching up to the next file-size unit)
Example: 999.99 MB then 1.00 GB (instead of 1000.00 MB which is what I get now)
Can anybody please let me know what scripting I would need to use to achieve this?
To avoid requiring manual scripting work-arounds in future, perhaps Florian could consider adding new 'human-readable' values for decimal and binary sizes to prevent confusion:
%_file_size_decimal% (displayed with KB, MB, GB, TB units)
%_file_size_binary% (displayed with KiB, MiB, GiB, TiB units)
%_file_size% value could be left in place (to retain backwards-compatibility and prevent breaking existing scripts) because it would offer a different option to the two new values (i.e. a kind of "hybrid": binary size but with decimal display units).
People can then choose whichever one best suits their needs.