|
Posted by Steve on 11/29/06 04:33
functions in the functions.inc.php:
function formatBytes($bytes)
{
if (!is_numeric($bytes)){ $bytes = 0; }
if ($bytes < 0){ $bytes = 0; }
$format = array( 'B', 'KB', 'MB', 'GB', 'TB');
$values = array( 0, 1024, 1048576, 1073741824, 1099511627776);
$i = floor(log($bytes) / 6.9314718055994530941723212145818);
if ($values[$i] == 0){ return '0 B'; }
return number_format(round($bytes / $values[$i])) . ' ' . $format[$i];
}
function isSupportedImage($description)
{
$description = strtolower($description);
$supportedExtensions = array (
'bmp' ,
'gif' ,
'jpg' ,
'jpeg' ,
'png' ,
'tif' ,
'tiff'
);
foreach ($supportedExtensions as $extension)
{
if (substr($description, -1 * strlen($extension)) == $extension){ return
true; }
}
return false;
}
function isSupportedMedia($description)
{
$description = strtolower($description);
$supportedExtensions = array (
'aif' ,
'aifc' ,
'aiff' ,
'asf' ,
'au' ,
'avi' ,
'cda' ,
'dvr-ms' ,
'm1v' ,
'mid' ,
'midi' ,
'mpa' ,
'mpe' ,
'mpeg' ,
'mpg' ,
'mp2' ,
'mp3' ,
'rmi' ,
'snd' ,
'vob' ,
'wav' ,
'wm' ,
'wma' ,
'wmv'
);
foreach ($supportedExtensions as $extension)
{
if (substr($description, -1 * strlen($extension)) == $extension){ return
true; }
}
return false;
}
Navigation:
[Reply to this message]
|