typo3fluidtypo3-4.5

In a fluid template, how to output the linked file's size?


In a fluid template, I would like to output a linked file's size.

I'm using f:link.page to link to the file, as I think this is the way to do it (please correct if not).

<f:link.page class="download" pageUid="fileadmin/redaktion/download/papers/{paper.download}" {paper.author}">PDF</f:link.page>

As I'm already using the extension ml_links on the site, I thought I could pass the link through lib.parseFunc_RTE, but

<f:format.html parseFuncTSPath="lib.parseFunc_RTE"><f:link.page class="download" pageUid="fileadmin/redaktion/download/papers/{paper.download}" {paper.author}">PDF</f:link.page></f:format.html>

just wraps it into p.bodytext.

Do I have to use a different syntax to apply f:format.html TO f:link.page - or is there a better way to do it (via a fluid or vhs viewhelper)?


Solution

  • When i use fluidcontent i have vhs extension installed aswell and then just use:

    <f:format.bytes decimals="1">{v:media.size(path: '{file}')}</f:format.bytes>
    

    This outputs clean readable sizes like "28.2 MB".