Project

General

Profile

Actions

Bug #77945

open

responsive IMAGE rendering does not work if inside FILES

Added by Sebastian Mazza about 8 years ago. Updated 3 months ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Image Generation / GIFBUILDER
Target version:
-
Start date:
2016-09-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #59533: OptionSplit cObjNum inside FILES CO does not workClosed2014-06-12

Actions
Actions

Also available in: Atom PDF