acf_format_filesize()
acf_format_filesize
This function will return a formatted string containing the filesize and unit
Хуков нет.
Возвращает
(int)
.
Использование
acf_format_filesize( $size );
- $size **
- -
По умолчанию: 1
Список изменений
С версии 5.1.5 | Введена. |
Код acf_format_filesize() acf format filesize ACF 6.0.4
function acf_format_filesize( $size = 1 ) { // convert $bytes = acf_get_filesize( $size ); // vars $units = array( 'TB' => 4, 'GB' => 3, 'MB' => 2, 'KB' => 1, ); // loop through units foreach ( $units as $k => $v ) { $result = $bytes / pow( 1024, $v ); if ( $result >= 1 ) { return $result . ' ' . $k; } } // return return $bytes . ' B'; }