Development

/plugins/sfPropelFileStoragePlugin/lib/helper/PropelFileStorageHelper.php

You must first sign up to be able to contribute.

root/plugins/sfPropelFileStoragePlugin/lib/helper/PropelFileStorageHelper.php

Revision 2605, 357 bytes (checked in by forkmantis, 3 years ago)

Migrated parse_file_size function into a helper. An error is now logged when a user calls the old function from the util class.

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.

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.