Discussion:
[TYPO3-german] FLUID image download with f:link.page and f:uri.image
Thomas Faßbender
2015-05-27 06:41:27 UTC
Permalink
Hi @all,

does anybody know why this small piece of code isn't working???

<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" width="{field.imagewidth}" />
<div>
<f:link.page pageUid="{f:uri.image(src:{fileReference},treatIdAsReference:1)}" target="_blank">
<i class="fa fa-save"></i> Download
</f:link.page>
</div>

All I want is to show an image with its download link.
In the frontend I can see the image, but the link isn't correct, it has no destination, same effect like #.

Thanks for help
Thomas
casi
2015-05-27 06:50:42 UTC
Permalink
try this

Link:
{f:uri.image(src:'{fileReference.originalResource.publicUrl}')}

Image:
{fileReference.originalResource.publicUrl}
Thomas Faßbender
2015-05-27 06:59:57 UTC
Permalink
<f:link.page pageUid="{f:uri.image(src:'{fileReference.originalResource.publicUrl}')}" target="_blank">
<i class="fa fa-save"></i> Download
</f:link.page>

generates the following error:

Templating tags not properly nested. Expected: TYPO3\CMS\Fluid\ViewHelpers\Link\PageViewHelper; Actual: TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper
Thomas Faßbender
2015-05-27 07:07:02 UTC
Permalink
Quote: Thomas Faßbender (thofas) wrote on Wed, 27 May 2015 08:59
----------------------------------------------------
Post by Thomas Faßbender
<f:link.page pageUid="{f:uri.image(src:'{fileReference.originalResource.publicUrl}')}" target="_blank">
<i class="fa fa-save"></i> Download
</f:link.page>
Templating tags not properly nested. Expected: TYPO3\CMS\Fluid\ViewHelpers\Link\PageViewHelper; Actual: TYPO3\CMS\Fluid\ViewHelpers\ForViewHelper
----------------------------------------------------

SORRY! this was from another bug.

Now I tried your solution, but with this no link will be built.

A quick look into {fileReference.originalResource} width f:debug shows that originalResource is NULL.
Any idea?
casi
2015-05-27 07:21:13 UTC
Permalink
in debug is NULL that is correct but this should work anyway.
{fileReference.originalResource.publicUrl} this should be the Link to the Original File.

Did you initialize the Object Storage in your Domain Model?
Thomas Faßbender
2015-05-27 07:23:56 UTC
Permalink
no access to this...this fluid template is inside a dce object, but this is configured correctly
casi
2015-05-27 07:27:11 UTC
Permalink
ah okay.

<f:link.page pageUid="{f:uri.image(src:'{fileReference}',treatIdAsReference:1)}" target="_blank">
<i class="fa fa-save"></i> Download
</f:link.page>

Try this again. I think you might missed the brackets '{fileReference}'
bernd wilke
2015-05-27 07:48:16 UTC
Permalink
Post by Thomas Faßbender
does anybody know why this small piece of code isn't working???
<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1"
^ here you use the uid to treat it as
reference
Post by Thomas Faßbender
width="{field.imagewidth}" />
<div>
<f:link.page
pageUid="{f:uri.image(src:{fileReference},treatIdAsReference:1)}"
^ here you have no uid to treat it as
reference
Post by Thomas Faßbender
target="_blank">
<i class="fa fa-save"></i> Download
</f:link.page>
</div>
I think you should use {fileReference} without treatIdAsReference="1"

for the second usage with the inline viewhelper:
I think you do not need the braces around fileReference and also you
should not use treatidAsReference as you have teh object as parameter.

bernd
--
http://www.pi-phi.de/cheatsheet.html
Loading...