Search code examples
typo3fluid-styled-contenttx-gridelements

Set maxImageWidth for images within gridelements col using fluid_styled_content (TS)


Defining a custom gridelement in TS one can setup the maxImageSize for an texmedia image rendered inside a col. So in a 50-50 grid one might set the max image width to 50% of the regular max.

columns {
  default {
    renderObj {
      10 = LOAD_REGISTER
      10.maxImageWidth = 273          
      30 = RESTORE_REGISTER
    }
  }
}

However this is not working using fluid_styled_content instead of css_styled_content. Anyone knows how to configure that using gridelements with fluid_styled_content?


Solution

  • Your code doesn´t work because the fluid_styled_content textmedia element is rendering the images inside a gallery. If you are above Typo3 7.4 you could use the Gallery Data Processor :

    columns {
      default {
        renderObj {
          textmedia {
            dataProcessing {
              20.maxGalleryWidth = 273
              20.maxGalleryWidthInText = 273
            }
          }
        }
      }
    }