This works, but a problem occurs when there is no picture set (e.g. when the page is freshly created), because image is NULL and that which yields
Argument 1 passed to TYPO3\Media\Domain\Service\AssetService_Original::getThumbnailUriAndSizeForAsset() must be an instance of TYPO3\Media\Domain\Model\AssetInterface, null given, called in /var/www/html/neos/SP/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Media_ViewHelpers_Uri_ImageViewHelper.php on line 91
thanks for the reply. I misspelled it in this post here, sorry – I corrected it. Problems stays the same, unfortunately.
I think the problem is, that there is a check if the call of {media:uri.image(image:image)} is valid despite of it really being executed. Is this possible?
The problem is that Fluid evaluates the then argument in your if condition view helper because it’s inline. Unfortunately you have to use <f:if><:then></then><f:else>… instead to avoid it being evaluated when no images has been selected.
Thank you very much for that explanation. Unfortunately this leads to redundancy in the code.
I found another way, defining image in the ts2 file in a way that i can just write style="background-image: url('{image}')" in the template:
Problem solved;
my Menu extends from the page and the backgroundImage was already defined in the page object. That was the reason why it didn’t work at all.