Make WordPress Core

Opened 9 years ago

Last modified 2 years ago

#31350 new defect (bug)

size_format() Displaying Incorrect Unit

Reported by: brashell's profile brashell Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.1
Component: General Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The size_format() function is using binary standards for displaying a human readable version of the file size, shouldn’t we use the IEC standard of KiB, MiB etc for the unit, or convert to SI and use 1000 instead of 1024 as the value of bytes in a kB etc (ref: It was even noted that it was technically incorrect in the comments of the function: (If we do fix it, we need to take into consideration the whitespace in front of the 'B ' fixed in: [31052])

Change History (5)

#1 @brashell
9 years ago

Changeset [31052], ticket #30908

Last edited 9 years ago by SergeyBiryukov (previous) (diff)

#2 @SergeyBiryukov
9 years ago

  • Description modified (diff)

#3 @dd32
9 years ago

I vaguely recall this coming up in the past, but couldn't find any tickets for it.

Some history of the KB vs KiB debate is in Wikipedia: which shows that until 2009/2010ish all major OS's displayed 1024B as 1KB, completely ignoring the IEC spec, so we followed along and used what everyone expects.
However, now OS X and Ubuntu (at least) have switched to using 1000B = 1KB, leaving Microsoft the hold-out of ignoring the IEC standard.

This is so minor that it can go either way to me, but if we do change anything, we should replace 1024 with 1000, just so we never have to display 'KiB' since that's even more unfamiliar to people. I doubt anyone would notice or complain that their website says the file is 2% larger than it really is, especially not with the filesizes most people upload.

#4 @Otto42
7 years ago

At least one case exists where a user assumed that their images were being compressed on upload because of the displayed filesize difference between the reading in the Media Library vs. what their OS is telling them:

Last edited 7 years ago by Otto42 (previous) (diff)
Note: See TracTickets for help on using tickets.