note 50144 deleted from function.filesize by aidan
| From: | aidan@php.net | Date: | Wed, 13 Jul 2005 03:05:40 +0000 |
| Subject: | note 50144 deleted from function.filesize by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-91843@lists.php.net to get a copy of this message | ||
Note Submitter: snowknight26 AT hotmail DOT com
----
To aidan at php dot net:
There is a much easier way of giving so called 'human readable' sizes.
<?php
list($width, $height) = getimagesize($filename);
$imgsize = filesize($filename)/1024;
$imgsize2 = round($imgsize, 0);
//Prints something like 153 KB.
echo $imgsize2." KB";
?>
In this case, I divided the filesize of $filename by 1024 since it prints it out in bytes. This will
show how many kilobytes it is. It will show something like 152.7123461239461. Thats where rounding
comes in hand.