Bug #97479
closedImageViewHelper doesen't support external image-url's anymore
0%
Description
External url's could not be resolved to a File or FileReference.
This no longer works in TYPO3 11 - until TYPO3 10 it worked fine.
Fluid example:
<f:image src="https://forge.typo3.org/themes/TYPO3/images/custom-topheader.jpg" />
Error (or see attachement):
#1509741912 TYPO3Fluid\Fluid\Core\ViewHelper\Exception
Supplied https://forge.typo3.org/themes/TYPO3/images/custom-topheader.jpg could not be resolved to a File or FileReference.
in ....\typo3_src-11.5.9\typo3\sysext\fluid\Classes\ViewHelpers\ImageViewHelper.php line 203
h2. h2.
Extension with which the behavior becomes apparent:
https://github.com/Hauer-Heinrich/hh_widget_hhnews
Files
Updated by Oliver Bartsch about 2 years ago
- Related to Bug #91212: System Email Template causes generation of FAL storage 0 records added
Updated by Helmut Hummel about 2 years ago
- Status changed from New to Needs Feedback
Thanks for your report.
Christian Hackl wrote:
External url's could not be resolved to a File or FileReference.
Can you elaborate a bit more on how exactly your expectations are, when feeding the image view helper with an external URL?
In particular how this expectation differs from using a <img> HTML tag directly.
Extension with which the behavior becomes apparent:
https://github.com/Hauer-Heinrich/hh_widget_hhnews
From my perspective, switching from the view helper to a simple img tag should fix the issue in the extension.
Updated by Christian Hackl about 2 years ago
My expectation is that it will work as before - maybe I'm too stupid to find it, but I haven't found any corresponding entry in the changelogs or any hint that this functionality is depricated or something like that.
Also it could be that you have mixed values in the image-array (external urls and system-internal urls).
Very simplified example:
<f:variable name="imageArray" value="{0: 'https://forge.typo3.org/themes/TYPO3/images/custom-topheader.jpg', 1: 'FAL-IMAGE-OBJECT'}" />
<f:for each="{imageArray}" as="image">
<f:image src="{image}" />
</f:for>
Updated by Helmut Hummel about 2 years ago
Christian Hackl wrote in #note-3:
My expectation is that it will work as before
That this worked before, is/was more of a bug, than a feature.
Unfortunately making something always "work as before" is not achievable, when changing anything within software.
The ImageViewHelper is designed to process FAL images.
This is even more apparent when looking at the <f.uri.image> view helper, which basically can not do anything when being called with a URL.
In the long run (was planned for many versions, but has not ben done yet) these view helpers will only accept FAL images via the image argument.
- maybe I'm too stupid to find it, but I haven't found any corresponding entry in the changelogs or any hint that this functionality is depricated or something like that.
This has been fixed in the related ticket. As said before, this was considered more of a bugfix to straighten the code in the email templates and remove the code in the view helpers, that were only introduced for this case.
Also it could be that you have mixed values in the image-array (external urls and system-internal urls).
Is this a theoretical case or do you have an example where you would need exactly this?
In the extension you referenced, code could be changed to just use the <img> tag, which works across all TYPO3 versions of course.
Anyway, your example would not work anyway for the following reason:
The "src" argument only accepts strings since the inception of this view helper. So you would need an if condition anyway, to pass {image} to the correct argument like so:
<f:variable name="imageArray" value="{0: 'https://forge.typo3.org/themes/TYPO3/images/custom-topheader.jpg', 1: FAL-IMAGE-OBJECT}" /> <f:for each="{imageArray}" as="image"> <f:if condition="{image -> my:isString()}"> <f:then> <f:image src="{image}" /> </f:then> <f:else> <f:image image="{image}" /> </f:else> </f:if> </f:for>
But then again, what do you think is the key feature that helps you do something that isn't possible by writing like so:
<f:variable name="imageArray" value="{0: 'https://forge.typo3.org/themes/TYPO3/images/custom-topheader.jpg', 1: FAL-IMAGE-OBJECT}" /> <f:for each="{imageArray}" as="image"> <f:if condition="{image -> my:isString()}"> <f:then> <img src="{image}" /> </f:then> <f:else> <f:image image="{image}" /> </f:else> </f:if> </f:for>
I would argue, that reading the template I proposed makes the intention much clearer.
Did I miss something?
Updated by Riccardo De Contardi over 1 year ago
- Status changed from Needs Feedback to Closed
Sorry for this late reply;
As @Helmut Hummel explains, the previous behavior was flawed, therefore I close this issue.
If you think that this is the wrong decision or there is still work to be done here, please open a new issue with a reference to this one.
Thank you and best regards