Search code examples
imagetypo3widthfluid

Typo3 Fluid ignoring max image sizes set in typoscript


I've set in my Constants

styles.content.textmedia.maxW = 400
styles.content.textmedia.maxWInText = 400
styles.content.imgtext.maxW = 800

and tried a simple

<f:image src="..."></f:image>

without any params and on the frontend the image is still rendered on its original width ignoring my maxW constants

The original problem was to set different maxW for each column in gridelements which also did not work for fluid content. So i tried to break it down to the simplest maxW setting and even that is not working.

If i take the Text & Image contentelement, it works as expected so i assume, the system is behaving correctly but for any reason fluid images are ignoring the setting?!

Is there anything i do wrong or is there something missing which sets the maxW for f:image? I cant set the maxW in the f:image directly cause it may be located in different columns with different sizes, so i have to set it outside of the f:image tag.

Update: The main target was to be able to use gridelements as the gridengine and using dce for creating content elements while the elements should knew about the column widths, they are located in to scale images properly.

With the help of Mikel Wohlschlegel i got the missing hint, to fix my problem.


Solution

  • Solution:

    gridelements config

    tt_content.gridelements_pi1.20.10.setup {
    
      default < lib.gridelements.defaultGridSetup
      default {
            columns {
                default {
                    renderObj = COA
                    renderObj {
                        10 = LOAD_REGISTER
                        10.padding1.cObject = TEXT
                        10.padding1.cObject.data = field:parentgrid_flexform_padding1
                        10.padding2.cObject = TEXT
                        10.padding2.cObject.data = field:parentgrid_flexform_padding2
                        10.padding3.cObject = TEXT
                        10.padding3.cObject.data = field:parentgrid_flexform_padding3
                        10.colMaxWidth.cObject = CASE
                        10.colMaxWidth.cObject {
                            key.data = field:parentgrid_flexform_grid
                            default = TEXT
                            default.value = 1224
                            default.prioriCalc = 1
                        }
                        20.image.dataProcessing.20.maxGalleryWidth.data = register:colWidth
                        20.image.dataProcessing.20.maxGalleryWidthInText.data = register:colWidth
    
                        30 = RESTORE_REGISTER
                    }
                }
            }
        }
    
      3 < .default
      3 {
        cObject = FLUIDTEMPLATE
        cObject {
          file = templates/gridelements/html/3columns.html
        }    
        columns {
          default.renderObj.10.colMaxWidth.cObject {
                    default.value = 1224/100*33
    
                    grid-20 = TEXT
                    grid-20.value = 1224/100*20
                    grid-20.prioriCalc = 1            
                    grid-25 = TEXT
                    grid-25.value = 1224/100*25
                    grid-25.prioriCalc = 1                      
                    grid-32 = TEXT
                    grid-32.value = 1224/100*32
                    grid-32.prioriCalc = 1                      
                } 
                0 < .default
                0.renderObj.10.colWidth.cObject = TEXT
                0.renderObj.10.colWidth.cObject {
                    data = register:colMaxWidth
                    stdWrap.dataWrap = | - {register:padding1} - {register:padding1}
                    prioriCalc = 1
                }
                1 < .default
                1.renderObj.10.colWidth.cObject = TEXT
                1.renderObj.10.colWidth.cObject {
                    data = register:colMaxWidth
                    stdWrap.dataWrap = | - {register:padding2} - {register:padding2}
                    prioriCalc = 1
                }
                2 < .default
                2.renderObj.10.colWidth.cObject = TEXT
                2.renderObj.10.colWidth.cObject {
                    data = register:colMaxWidth
                    stdWrap.dataWrap = | - {register:padding3} - {register:padding3}
                    prioriCalc = 1
                }           
            }
        }
    

    in dce fluid than i can use

    {namespace vhs=FluidTYPO3\Vhs\ViewHelpers}
    {vhs:variable.register.get(name: 'colWidth')}
    

    to access this register value.