#96823<f:image src="{file-path-to-image}"> with config.absRefPrefix not working in TYPO3 11
Description
If you user <f:image src="{file-path-to-image}"> together with config.absRefPrefix = <a href="https://www.domain.at/" target="_blank" rel="noreferrer">https://www.domain.at/</a> an error will occure:<br>Supplied <a href="https://www.domain.at/fileadmin/user_upload/anim.gif" target="_blank" rel="noreferrer">https://www.domain.at/fileadmin/user_upload/anim.gif</a> could not be resolved to a File or FileReference.</f:image>
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 16
-
Bastian Bringenberg commented and changed project id category TYPO3 Version 11 <span data-processor="relativetime" data-value="2022-02-11T08:45:14+00:00" > 02/11/22, 08:45 </span>
-
Oliver Hader commented and changed category <span data-processor="relativetime" data-value="2022-02-11T09:33:32+00:00" > 02/11/22, 09:33 </span>
Do you have by chance a stack trace of mentioned exception at hand?
-
Martin Weymayer commented <span data-processor="relativetime" data-value="2022-02-11T09:40:04+00:00" > 02/11/22, 09:40 </span>
in /html/typo3/typo3_src-11.5.5/typo3/sysext/fluid/Classes/ViewHelpers/ImageViewHelper.php line 203 // thrown if file does not exist throw new Exception($e->getMessage(), 1509741911, $e); } catch (\UnexpectedValueException $e) { // thrown if a file has been replaced with a folder throw new Exception($e->getMessage(), 1509741912, $e); } catch (\RuntimeException $e) { // RuntimeException thrown if a file is outside of a storage throw new Exception($e->getMessage(), 1509741913, $e); } catch (\InvalidArgumentException $e) { at TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper->render() at call_user_func(array(object(TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper), 'render')) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 264 */ protected function callRenderMethod() { if (method_exists($this, 'render')) { return call_user_func([$this, 'render']); } if ((new \ReflectionMethod($this, 'renderStatic'))->getDeclaringClass()->getName() !== AbstractViewHelper::class) { // Method is safe to call - will not recurse through ViewHelperInvoker via the default // implementation of renderStatic() on this class. at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->callRenderMethod() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 252 { $this->validateArguments(); $this->initialize(); return $this->callRenderMethod(); } /** * Call the render() method and handle errors. at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->initializeArgumentsAndRender() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/ViewHelperInvoker.php line 79 } $viewHelper->setRenderingContext($renderingContext); $viewHelper->setArguments($evaluatedArguments); $viewHelper->handleAdditionalArguments($undeclaredArguments); return $viewHelper->initializeArgumentsAndRender(); } catch (Exception $error) { return $renderingContext->getErrorHandler()->handleViewHelperError($error); } } at TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker->invoke(object(TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper), array('src' => object(TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode)), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/ViewHelperNode.php line 150 * @return string evaluated node after the view helper has been called. */ public function evaluate(RenderingContextInterface $renderingContext) { return $renderingContext->getViewHelperInvoker()->invoke($this->uninitializedViewHelper, $this->arguments, $renderingContext); } } at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode->evaluate(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 56 * @return mixed */ protected function evaluateChildNode(NodeInterface $node, RenderingContextInterface $renderingContext, $cast) { $output = $node->evaluate($renderingContext); if ($cast) { $output = $this->castToString($output); } return $output; at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode->evaluateChildNode(object(TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext), false) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 36 public function evaluateChildNodes(RenderingContextInterface $renderingContext) { $evaluatedNodes = []; foreach ($this->getChildNodes() as $childNode) { $evaluatedNodes[] = $this->evaluateChildNode($childNode, $renderingContext, false); } // Make decisions about what to actually return if (empty($evaluatedNodes)) { return null; at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode->evaluateChildNodes(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 306 if ($this->renderChildrenClosure !== null) { $closure = $this->renderChildrenClosure; return $closure(); } return $this->viewHelperNode->evaluateChildNodes($this->renderingContext); } /** * Helper which is mostly needed when calling renderStatic() from within at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->renderChildren() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 321 protected function buildRenderChildrenClosure() { $self = clone $this; return function() use ($self) { return $self->renderChildren(); }; } /** at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->TYPO3Fluid\Fluid\Core\ViewHelper\{closure}() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/ViewHelpers/ForViewHelper.php line 148 $templateVariableContainer->add($arguments['iteration'], $iterationData); $iterationData['index']++; $iterationData['cycle']++; } $output .= $renderChildrenClosure(); $templateVariableContainer->remove($arguments['as']); if (isset($arguments['key'])) { $templateVariableContainer->remove($arguments['key']); } at TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper::renderStatic(array('each' => array(object(TYPO3\CMS\Core\Resource\FileReference)), 'as' => 'file', 'key' => null, 'reverse' => false, 'iteration' => null), object(Closure), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/Traits/CompileWithRenderStatic.php line 30 { return static::renderStatic( $this->arguments, $this->buildRenderChildrenClosure(), $this->renderingContext ); } /** at TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper->render() at call_user_func(array(object(TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper), 'render')) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 264 */ protected function callRenderMethod() { if (method_exists($this, 'render')) { return call_user_func([$this, 'render']); } if ((new \ReflectionMethod($this, 'renderStatic'))->getDeclaringClass()->getName() !== AbstractViewHelper::class) { // Method is safe to call - will not recurse through ViewHelperInvoker via the default // implementation of renderStatic() on this class. at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->callRenderMethod() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 252 { $this->validateArguments(); $this->initialize(); return $this->callRenderMethod(); } /** * Call the render() method and handle errors. at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->initializeArgumentsAndRender() in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/ViewHelper/ViewHelperInvoker.php line 79 } $viewHelper->setRenderingContext($renderingContext); $viewHelper->setArguments($evaluatedArguments); $viewHelper->handleAdditionalArguments($undeclaredArguments); return $viewHelper->initializeArgumentsAndRender(); } catch (Exception $error) { return $renderingContext->getErrorHandler()->handleViewHelperError($error); } } at TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker->invoke(object(TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper), array('each' => object(TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode), 'as' => object(TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\TextNode)), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/ViewHelperNode.php line 150 * @return string evaluated node after the view helper has been called. */ public function evaluate(RenderingContextInterface $renderingContext) { return $renderingContext->getViewHelperInvoker()->invoke($this->uninitializedViewHelper, $this->arguments, $renderingContext); } } at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode->evaluate(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 56 * @return mixed */ protected function evaluateChildNode(NodeInterface $node, RenderingContextInterface $renderingContext, $cast) { $output = $node->evaluate($renderingContext); if ($cast) { $output = $this->castToString($output); } return $output; at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode->evaluateChildNode(object(TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext), false) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/AbstractNode.php line 36 public function evaluateChildNodes(RenderingContextInterface $renderingContext) { $evaluatedNodes = []; foreach ($this->getChildNodes() as $childNode) { $evaluatedNodes[] = $this->evaluateChildNode($childNode, $renderingContext, false); } // Make decisions about what to actually return if (empty($evaluatedNodes)) { return null; at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\AbstractNode->evaluateChildNodes(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/SyntaxTree/RootNode.php line 25 * @return mixed Evaluated subtree */ public function evaluate(RenderingContextInterface $renderingContext) { return $this->evaluateChildNodes($renderingContext); } } at TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode->evaluate(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/Core/Parser/ParsingState.php line 119 * @return string Rendered string */ public function render(RenderingContextInterface $renderingContext) { return $this->getRootNode()->evaluate($renderingContext); } /** * Push a node to the node stack. The node stack holds all currently open at TYPO3Fluid\Fluid\Core\Parser\ParsingState->render(object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext)) in /html/typo3/typo3_src-11.5.5/vendor/typo3fluid/fluid/src/View/AbstractTemplateView.php line 186 } if (!$parsedTemplate->hasLayout()) { $this->startRendering(self::RENDERING_TEMPLATE, $parsedTemplate, $this->baseRenderingContext); $output = $parsedTemplate->render($this->baseRenderingContext); $this->stopRendering(); } else { $layoutName = $parsedTemplate->getLayoutName($this->baseRenderingContext); try { at TYPO3Fluid\Fluid\View\AbstractTemplateView->render() in /html/typo3/typo3_src-11.5.5/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php line 341 * @return string */ protected function renderFluidView() { return $this->view->render(); } /** * Apply standard wrap to content at TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject->renderFluidView() in /html/typo3/typo3_src-11.5.5/typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php line 106 $this->view->assignMultiple($variables); $this->renderFluidTemplateAssetsIntoPageRenderer(); $content = $this->renderFluidView(); $content = $this->applyStandardWrapToRenderedContent($content, $conf); $this->view = $parentView; return $content; at TYPO3\CMS\Frontend\ContentObject\FluidTemplateContentObject->render(array('templateRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Templates/'), 'partialRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Partials/'), 'layoutRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Layouts/'), 'dataProcessing.' => array('MASK\\Mask\\DataProcessing\\MaskProcessor'), 'templateName' => 'TextUndAnimiertesGifJe50')) in /html/typo3/typo3_src-11.5.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 800 } // Render content try { $content .= $contentObject->render($configuration); } catch (ContentRenderingException $exception) { // Content rendering Exceptions indicate a critical problem which should not be // caught e.g. when something went wrong with Exception handling itself throw $exception; at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render(object(MASK\Mask\Fluid\FluidTemplateContentObject), array('templateRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Templates/'), 'partialRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Partials/'), 'layoutRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Layouts/'), 'dataProcessing.' => array('MASK\\Mask\\DataProcessing\\MaskProcessor'), 'templateName' => 'TextUndAnimiertesGifJe50')) in /html/typo3/typo3_src-11.5.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 736 $timeTracker->decStackPointer(); } else { $contentObject = $this->getContentObject($name); if ($contentObject) { $content .= $this->render($contentObject, $conf); } } if ($timeTracker->LR) { $timeTracker->pull($content); at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('FLUIDTEMPLATE', array('templateRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Templates/'), 'partialRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Partials/'), 'layoutRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Layouts/'), 'dataProcessing.' => array('MASK\\Mask\\DataProcessing\\MaskProcessor'), 'templateName' => 'TextUndAnimiertesGifJe50'), 'lib.maskContentElement') in /html/typo3/typo3_src-11.5.5/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 731 [$name, $conf] = $cF->getVal($key, $this->getTypoScriptFrontendController()->tmpl->setup); $conf = array_replace_recursive($conf, $confOverride); // Getting the cObject $timeTracker->incStackPointer(); $content .= $this->cObjGetSingle($name, $conf, $key); $timeTracker->decStackPointer(); } else { $contentObject = $this->getContentObject($name); if ($contentObject) { at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('FLUIDTEMPLATE', array('templateRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Templates/'), 'partialRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Partials/'), 'layoutRootPaths.' => array('typo3conf/ext/mw_theme/Resources/Private/Mask/Frontend/Layouts/'), 'dataProcessing.' => array('MASK\\Mask\\DataProcessing\\MaskProcessor'), 'templateName' => 'TextUndAnimiertesGifJe50'), 'tt_content.mask_text_und_animiertes_gif_je_50') in /html/typo3/typo3_src-11.5.5/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php line 197 if ($timeTracker->LR) { $timeTracker->push('/f:cObject/', '<' . $typoscriptObjectPath); } $timeTracker->incStackPointer(); $content = $contentObjectRenderer->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.'] ?? [], $typoscriptObjectPath); $timeTracker->decStackPointer(); if ($timeTracker->LR) { $timeTracker->pull($content); } at TYPO3\CMS\Fluid\ViewHelpers\CObjectViewHelper::renderContentObject(object(TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer), array('key.' => -
Oliver Hader commented <span data-processor="relativetime" data-value="2022-02-11T10:27:14+00:00" > 02/11/22, 10:27 </span>
.. is the candidate (a few lines below, there’s the exception message that has been reported initially).
Thus, the question is, where
fileadmin/user_upload/anim.gifgets extended tohttps://www.domain.at/fileadmin/user_upload/anim.gifand handed in to that method. -
Martin Weymayer commented <span data-processor="relativetime" data-value="2022-02-11T16:09:33+00:00" > 02/11/22, 16:09 </span>
Sorry, I do not understand your question. I can not answer it. This is a fluid template with MASK extension
-
Markus Slaby commented <span data-processor="relativetime" data-value="2022-09-25T06:12:20+00:00" > 09/25/22, 06:12 </span>
Martin Weymayer wrote:
> If you user <f:image src="{file-path-to-image}"> together with config.absRefPrefix = <a href="https://www.domain.at/" target="_blank" rel="noreferrer">https://www.domain.at/</a> an error will occure:<br>> Supplied <a href="https://www.domain.at/fileadmin/user_upload/anim.gif" target="_blank" rel="noreferrer">https://www.domain.at/fileadmin/user_upload/anim.gif</a> could not be resolved to a File or FileReference.</f:image>I have the same problem here in a fluid page layout, while using an image from page resources. I use TYPO3 11.5.16 with php 8.1.5
-
Jan Kornblum commented <span data-processor="relativetime" data-value="2024-04-11T16:32:30+00:00" > 04/11/24, 16:32 </span>
Same here with TYPO3 11.5.36 and PHP 8.3 when using config.absRefPrefix = https://www.domain.tld/
-
Helmut Hummel commented <span data-processor="relativetime" data-value="2025-09-11T12:37:08+00:00" > 09/11/25, 12:37 </span>
Can you please post your Fluid template code?
-
Martin Weymayer commented <span data-processor="relativetime" data-value="2025-09-11T12:48:14+00:00" > 09/11/25, 12:48 </span>
as in my post mentioned: <f:image src="{file-path-to-image}"></f:image>
-
Helmut Hummel commented <span data-processor="relativetime" data-value="2025-09-13T13:20:48+00:00" > 09/13/25, 13:20 </span>
Martin Weymayer wrote in #note-9:
> as in my post mentioned: <f:image src="{file-path-to-image}"></f:image>Where ist the value of file-path-to-image obtained from? And what exactly is the value?
What is the reason for not using “image={fileObject}”
-
Helmut Hummel commented <span data-processor="relativetime" data-value="2025-09-13T16:33:09+00:00" > 09/13/25, 16:33 </span>
Helmut Hummel wrote in #note-10:
> What is the reason for not using “image={fileObject}”I assume the following: The view helper is called with the publicUrl obtained by a file object earlier. Since the publicUrl is prefixed with absRefPrefix since TYPO3 v11, using a fully qualified URL as source for the image object will fail.
-
Martin Weymayer commented <span data-processor="relativetime" data-value="2025-09-16T06:18:51+00:00" > 09/16/25, 06:18 </span>
Where ist the value of file-path-to-image obtained from? It is a path to a placeholder image (no fal or fileObject)
What is the reason for not using “image={fileObject}”: In my opinion, it shouldn’t matter whether and why no fal is used.
I assume the following: The view helper is called with the publicUrl obtained by a file object earlier: nope. image is like src=“fileadmin/images/placeholder.png” -
Helmut Hummel commented and changed status
NewNeeds Feedback <span data-processor="relativetime" data-value="2025-09-16T08:28:14+00:00" > 09/16/25, 08:28 </span>Martin Weymayer wrote in #note-12:
> image is like src=“fileadmin/images/placeholder.png”With a value like this, I can’t reproduce the reported exception, neither in main nor TYPO3 11
Here is my test code (given the file pexels-hermaion-106346.jpg exists in fileadmin):
page.20 = FLUIDTEMPLATE page.20.template = TEXT page.20.template.value ( <f:image src="fileadmin/pexels-hermaion-106346.jpg" /> ) -
Helmut Hummel commented <span data-processor="relativetime" data-value="2025-09-16T08:40:03+00:00" > 09/16/25, 08:40 </span>
Helmut Hummel wrote in #note-13:
> Martin Weymayer wrote in #note-12:
> > image is like src=“fileadmin/images/placeholder.png”I’m only getting the exception when supplying a full URL like:
https://typo3-main.test/fileadmin/images/placeholder.png and this also in TYPO3 mainBut then, why would I supply a domain name manually?
I’m trying to help, fix something or give advice. Please provide a little more background info how to exactly reproduce the issue you are seeing.
-
Helmut Hummel commented <span data-processor="relativetime" data-value="2025-09-16T08:52:54+00:00" > 09/16/25, 08:52 </span>
Here some examples of what is working and what not in my tests:
page = PAGE config.contentObjectExceptionHandler = 0 config.absRefPrefix = https://typo3-main.test/ page.20 = FLUIDTEMPLATE page.20.dataProcessing { 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor 10 { files = 3 as = files } } page.20.template = TEXT page.20.template.value ( <!-- This one works --> <f:image image="{files.0}" /> <!-- This one works --> <f:image src="fileadmin/pexels-hermaion-106346.jpg" /> <!-- This one fails --> <f:image src="https://typo3-main.test/fileadmin/pexels-hermaion-106346.jpg" /> <!-- This one fails --> <f:image src="{files.0.publicUrl}" /> <!-- This one fails --> <f:image src="path/to/not/existing/file.jpg" /> )Regarding the failing examples, I’m asking why and how the values are supplied as shown.
-
Georg Ringer commented and changed status
Needs FeedbackClosed <span data-processor="relativetime" data-value="2026-10-06T16:59:02+00:00" > 10/06/26, 16:59 </span>closing the issue, also as part of trying to cleanup forge a bit.
providing the full URL to f:image is not something which should work, just use then.
if this is a different issue and still fails for you in v14, please open a new issue and provide information to reproduce it.
Moved to right project and changed TYPO3 Version.