Bug #77945
openresponsive IMAGE rendering does not work if inside FILES
0%
Description
OptionSplit for config key layout.$layoutKey.source of an IMAGE does not work if the IMAGE is a renderObj of a FILES content element.
The FILES content object resolves all optionSplit strings for the file count.
Therefor, when the IMAGE content object wants to split the layout.$layoutKey for the count of sourceCollection items the optionSplit strings are already resolved but for the wrang thing.
This bug breaks the key feature for responsive image rendering (https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Image/Index.html#cobj-image-layoutkey).
FILES rendering:
$splitConf = $GLOBALS['TSFE']->tmpl->splitConfArray($conf, $availableFileObjectCount);
in
sysext/frontend/Classes/ContentObject/FilesContentObject.php :: render(), Line: 43
IMAGE rendering:
$srcLayoutOptionSplitted = $tsfe->tmpl->splitConfArray($conf['layout.'][$layoutKey . '.'], count($activeSourceCollections));
in
sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php :: getImageSourceCollection() , Line:1678
TS Example that takes the first image from the page media column:
lib.headerImage = FILES lib.headerImage { references { data = levelmedia:-1, slide } begin = 0 maxItems = 1 renderObj = IMAGE renderObj { file { treatIdAsReference = 1 import.data = file:current:uid width = 320c height = 133c } sourceCollection { x320 { width = 320c height = 133c srcsetCandidate = 320w } x640 { width = 640c height = 267c srcsetCandidate = 640w } x1242 { width = 1242c height = 517c srcsetCandidate = 1242w } } layoutKey = srcset layout { srcset { element = <img src="###SRC###" srcset="###SOURCECOLLECTION###" sizes="100vw" ###PARAMS### ###ALTPARAMS### ###SELFCLOSINGTAGSLASH###> # the optionSplits in the next line gets resolved by the FILES renderer and not the IMAGE renderer => missing "," for the last img tag, and and wrong "," at the end for all other img tags source = |*|###SRC### ###SRCSETCANDIDATE###,|*|###SRC### ###SRCSETCANDIDATE### } } altText.data = file:current:alternative titleText.data = file:current:title } }
Result of this example is a image element with missing "," inside the srcset attribute.
Updated by Benjamin Robinson about 8 years ago
I don't know how to fix this bug, but i found a workaround:
source = ###SRC### ###SRCSETCANDIDATE###
x320 { width = 320c height = 133c srcsetCandidate = 320w, } x640 { width = 640c height = 267c srcsetCandidate = 640w, } x1242 { width = 1242c height = 517c srcsetCandidate = 1242w }
Updated by Sebastian Mazza about 8 years ago
Thank you Ben, for sharing your workaround!
Updated by Riccardo De Contardi over 7 years ago
It is still reproducible on the latest master (9.0.0-dev)
Updated by Susanne Moog about 7 years ago
- Category changed from Image Cropping to Image Generation / GIFBUILDER
Updated by Patrick Lenk about 6 years ago
- TYPO3 Version changed from 7 to 8
- PHP Version set to 7.2
Ben Robinson wrote:
I don't know how to fix this bug, but i found a workaround:
[...]
[...]
I can confirm this bug for 8.7.20. The workaround from Ben works!
Updated by Stephan grass 9 months ago
It's still a bug in TYPO3 11, or possibly TYPO3 12.
It's easily manageable with the workaround, but either it's a bug or the documentation needs updating.
Updated by Riccardo De Contardi 3 months ago
Still valid for both TYPO3 12 and 13 (latest main)