Documentation · ViewHelper reference

Format / BytesViewHelper


Formats an integer with a byte count into human-readable form.

Examples

Defaults

{fileSize -> f:format.bytes()}

Output

123 KB
// depending on the value of {fileSize}

Defaults

{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: ',', thousandsSeparator: ',')}

Output

1,023.00 B
// depending on the value of {fileSize}

  • Tag usage example

    <f:format.bytes value="123" decimals="123" decimalSeparator="'.'" thousandsSeparator="','">
    	<!-- tag content - may be ignored! -->
    </f:format.bytes>
  • Inline usage example

    {f:format.bytes(value: 123, decimals: 123, decimalSeparator: ''.'', thousandsSeparator: '','')}

Arguments

Argument Description Type
decimalSeparator

The decimal point character

string
decimals

The number of digits after the decimal point

integer
thousandsSeparator

The character for grouping the thousand digits

string
value

The incoming data to convert, or NULL if VH children should be used

integer
Required attribute

Revision history

commit 7985a653d4886336cf43c93c268c7f4ae6f5de07
Author: Wouter Wolters <*****@wouterwolters.nl>
Date:   Fri Jun 14 20:04:11 2013 +0200

    [FEATURE] ViewHelper to display file sizes
    
    Simple ViewHelper that converts the size of a file to a human
    readable string.
    
    Usage:
    {fileSize -> f:format.bytes()}
    
    Change-Id: Iffb155e209fe0d2e89aae6d93706e994b4b0b8e7
    Resolves: #49139
    Related: #49128
    Releases: 6.2
    Reviewed-on: https://review.typo3.org/21436
    Reviewed-by: Philipp Gampe
    Tested-by: Philipp Gampe
    Reviewed-by: Zbigniew Jacko
    Tested-by: Zbigniew Jacko
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn

commit 77f29a3c69a7cbb27b34072754aa503bace6c9f1
Author: Christian Kuhn <*****@schwarzbu.ch>
Date:   Tue Oct 1 14:40:56 2013 +0200

    [TASK] Remove closing PHP tags
    
    Change-Id: Iaa92566c53301e49396fc9fb26b0b339c48d567b
    Resolves: #52360
    Releases: 6.2
    Reviewed-on: https://review.typo3.org/24212
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn
    Reviewed-by: Ernesto Baschny
    Tested-by: Ernesto Baschny
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring