TYPO3: get path out of file reference in Extbase

extbase, fluid, typo3

Solution

What you have there, is a file reference of `FAL`, the file abstraction layer.

First things first, if you use FlexForms in combination with ActionController (or any realisation of AbstractController) you should be able to access the `settings` property to compute your FlexForm values.

To compute `sys_file_reference` records, you should refer to the FAL docs on typo3.org (and the perma-linked section about file and folder handling).

In general, you should be able to call `getOriginalResource()` on a `\TYPO3\CMS\Extbase\Domain\Model\FileReference` object. For more concrete examples, either refer to the doc links or have a look at the wiki for a example handling FileReferences.

If you want to compute such reference via fluid templating, you can use the `treatIdAsReference` argument on f:image:

` <f:image src="{imageObj.uid}" width="150" height="100" treatIdAsReference="1" /> `

Problem

i've created a Custom Content Element with Fluid and Extbase (TYPO3 6.1), in which you can define a picture. In the picture-settings i can set a img-link, which is targetting a file. In my Controller i can access this data with ``` $this->configurationManager->getContentObject(); ``` But i just get a file-reference for this setting and no path. like this: ``` file:1206 ``` I've googled a lot and i didn't find a solution to access the path. Has anybody a solution or knows maybe a function in the configurationmanager or something else? I've spend hours on this problem... Thanks a lot!

Original source