N°330 Attachments display as table : console

This commit is contained in:
Pierre Goiffon
2019-12-12 10:56:19 +01:00
parent 21d5de1756
commit 4aeb78ccac
10 changed files with 1362 additions and 1011 deletions

View File

@@ -75,6 +75,29 @@ class ormDocument
return $this->m_sMimeType;
}
/**
* @return int size in bits
* @uses strlen which returns the no of bits used
* @since 2.7.0
*/
public function GetSize()
{
return strlen($this->m_data);
}
public function GetFormatedSize($precision = 2)
{
$bytes = $this->GetSize();
$units = array('B', 'KB', 'MB', 'GB', 'TB');
$bytes = max($bytes, 0);
$pow = floor(($bytes ? log($bytes) : 0) / log(1024));
$pow = min($pow, count($units) - 1);
$bytes /= pow(1024, $pow);
return round($bytes, $precision).' '.$units[$pow];
}
public function GetData()
{
return $this->m_data;