tomole
(Tom Ole)
January 8, 2019, 10:18am
1
I have a property which looks like:
'pdfUpload':
type: 'Neos\Media\Domain\Model\Asset'
ui:
label: i18n
inspector:
group: 'upload'
How to access to the url of the given file in the frontend? The docs only contain MediaHelper for images and thumbnails. https://neos.readthedocs.io/en/stable/References/ViewHelpers/Media.html
kdambekalns
(Karsten Dambekalns)
January 10, 2019, 8:16am
2
For use in PHP, see Persistent Resources in the Accessing Resources section of the documentation.
In case you need this in Fusion, see Neos.Fusion:ResourceUri
.
For Fluid, you were close, I think. See f:uri.resource
1 Like
tomole
(Tom Ole)
January 11, 2019, 5:13pm
3
Thanks for the reply.
I just tried but didnt get it work out. Can u provide a working example?
<f:if condition="{pdfUpload}">
<f:debug>{pdfUpload}</f:debug>
</f:if>
Result:
Neos\Flow\Persistence\Doctrine\Proxies\__CG__\Neos\Media\Domain\Model\Documentpersistableproxy
I tried but didnt work out:
{f:uri.resource(ressource : pdfUpload)}
kdambekalns
(Karsten Dambekalns)
January 13, 2019, 5:43pm
4
Did you really try two s
? It should be {f:uri.resource(resource : pdfUpload)}
tomole
(Tom Ole)
January 13, 2019, 7:43pm
5
Yes you are right. My bad.
But unfortunately there was another mistake. As you can see here in the Persistent resource object example, you have to append .resource
to the property.
https://neos.readthedocs.io/en/stable/References/ViewHelpers/FluidAdaptor.html#id66
The working result ends up in:
{f:uri.resource(resource : pdfUpload.resource)}
Thanks a lot. I appreciate your help.