root/plugins/sfPropelFileStoragePlugin/lib/helper/PropelFileStorageHelper.php
| Revision 2605, 357 bytes (checked in by forkmantis, 3 years ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | |
| 3 | /* Thanks to: http://www.php.net/manual/en/function.filesize.php#64387 */ |
| 4 | function parse_file_size($size) |
| 5 | { |
| 6 | /* |
| 7 | Returns a human readable size |
| 8 | */ |
| 9 | $i=0; |
| 10 | $iec = array("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"); |
| 11 | while (($size/1024)>1) { |
| 12 | $size=$size/1024; |
| 13 | $i++; |
| 14 | } |
| 15 | |
| 16 | return substr($size,0,strpos($size,'.')+4).' '.$iec[$i]; |
| 17 | } |
| 18 |
Note: See TracBrowser for help on using the browser.

