Pixel-Artist
11-15-2005, 04:37 PM
is there a way to display file size in kbs?
using the php filesize function of course.
using the php filesize function of course.
|
Click to See Complete Forum and Search --> : filesize Pixel-Artist 11-15-2005, 04:37 PM is there a way to display file size in kbs? using the php filesize function of course. LiLcRaZyFuZzY 11-15-2005, 04:40 PM <?php $file = "image.jpg"; $filesize = filesize($file); $filesize /= 1024; echo $filesize; ?> bokeh 11-15-2005, 04:48 PM <?php $file = "image.jpg"; $filesize = filesize($file); $filesize /= 1000; echo $filesize; ?> Didn't US congress declare the size of a kilobyte was 1024? Or was it Bill Gates? jenorthar 11-15-2005, 04:49 PM Actually it should be 1024, not 1000. Pixel-Artist 11-15-2005, 04:58 PM ok now I got another question... How do I make it round off to the hundreths place? LiLcRaZyFuZzY 11-15-2005, 05:29 PM erm yes sorry, did too much work on SI units lately -- http://www.php.net/round LiLcRaZyFuZzY 11-15-2005, 05:44 PM Didn't US congress declare the size of a kilobyte was 1024? Or was it Bill Gates? and by the way, maybe they did..but then they did something wrong, the actual unit that represents 1024 bytes is 1 Kibibyte (http://en.wikipedia.org/wiki/Kibibyte). rincewind456 11-15-2005, 06:05 PM and by the way, maybe they did..but then they did something wrong, the actual unit that represents 1024 bytes is 1 Kibibyte (http://en.wikipedia.org/wiki/Kibibyte). No! originally a kilobyte was 1024 bytes, the only reason kibibyte came into existence is because storage device manufacturers have conveniently forgotten the extra 24 bytes when advertising their storage devices, therefore gulling the public into believing they were buying larger storage devices than they actually were. http://en.wikipedia.org/wiki/Kilobyte LiLcRaZyFuZzY 11-15-2005, 06:44 PM kilo = 1000, so even if , and i agree, 1 kilobyte = 1024 byte, it is a misuse of that prefix. rincewind456 11-15-2005, 06:50 PM Maybe so, but that doesn't change the history of the words. LiLcRaZyFuZzY 11-15-2005, 07:05 PM http://en.wikipedia.org/wiki/Binary_prefix Binary prefixes using SI symbols (Non-standard usage but common) In 1999, the International Electrotechnical Commission (IEC) published Amendment 2 to "IEC 60027-2: Letter symbols to be used in electrical technology – Part 2: Telecommunications and electronics". This standard, which was approved in 1998, introduced the prefixes kibi-, mebi-, gibi-, tebi-, pebi-, exbi-, to be used in specifying binary multiples of a quantity. The names come from the first two letters of the original SI prefixes followed by bi which is short for "binary". It also clarifies that, from the point of view of the IEC, the SI prefixes only have their base-10 meaning and never have a base-2 meaning. NogDog 11-15-2005, 09:20 PM Use sprintf() (http://www.php.net/sprintf) or round() (http://www.php.net/round) to format the output. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |