2

I am trying to get the max image width in column 0 to be larger than the default. But I can't get it to work... can anyone help?

This is my (not working) typoscript I have so far:

temp.mW < tt_content.image.20.maxW
tt_content.image.20.maxW >
tt_content.image.20.maxW.cObject = CASE
tt_content.image.20.maxW.cObject {
  key.field=colPos
  default < temp.mW
  0 = TEXT
  0.value = 1920
}
user500665
  • 1,220
  • 1
  • 12
  • 38
  • Take a look on my question under http://stackoverflow.com/questions/39663830/maxgallerywidth-for-fluid-styled-content I have there also an override depended on the colPos. – René Pflamm Nov 04 '16 at 09:54

3 Answers3

2

I have just found that I had it right, but I also needed to overwrite the override to get it to work:

temp.mW < tt_content.image.20.maxW
tt_content.image.20.maxW >
tt_content.image.20.maxW.cObject = CASE
tt_content.image.20.maxW.cObject {
  key.field=colPos
  default < temp.mW
  0 = TEXT
  0.value = 1920
  0.override = TEXT
  0.override.value = 1920
}
user500665
  • 1,220
  • 1
  • 12
  • 38
0

If you are using css_styled_content, here is my solution. Ensure to define also maxWInText.

### max width for each column 
tt_content {
    # Define max image width of contentelements type=images, for each content column separately
    image.20.maxW.cObject = CASE
    image.20.maxW.cObject {
        key.field = colPos
        # 900px - padding (2 x 30px)
        default = TEXT
        default.value = 840
        # normal
        0 = TEXT
        0 < .default
        # left
        1 = TEXT
        1.value = 165
        # right
        2 = TEXT
        2.value = 155
        # 3 border
    }
    # Define max image width of contentelements type=textWithImages, for each content column separately
    /**
    * !NOTE:
    * This value is simply half the size of tt_content.image.20.maxW.cObject
    * Here or otherwise, typoscript prioriCalc can be used to simply halve the values of tt_content.image.20.maxW.
    */
    image.20.maxWInText.cObject = CASE
    image.20.maxWInText.cObject {
        key.field = colPos
        default = TEXT
        # 1/2 of 900px - padding (2 x 30px)
        default.value = 390
        # normal
        0 = TEXT
        0 < .default
        # left
        1 = TEXT
        1.value = 82
        # right
        2 = TEXT
        2.value = 77
        # 3 border
    }
}
jokumer
  • 2,249
  • 11
  • 22
  • This seems to be the same as what I have above but with the added maxWInText. I added it, but my images are only getting 955px wide instead of 1920. Looks like it's being halved - 5px. Is there something else I need to override? – user500665 Nov 03 '16 at 21:07
  • You can also do this using `LOAD_REGISTER` and `RESTORE_REGISTER`, as the `maxW` comes from one. So when rendering one column, make it a `COA`, the first entry being a `LOAD_REGISTER`, then one ore more entries rendering the column, and then a final `RESTORE_REGISTER`. Sadly I can't remember the register name... but that's the way I did it when using TypoScript. – Jost Nov 04 '16 at 06:52
0

Normally you would create a content object this way:

content_colPos_0 < styles.content.get

If no renderObj is given than the default tt_content is used, but you can set it yourself and overwrite what you need:

content_colPos_0 < styles.content.get
content_colPos_0 {
    renderObj < tt_content
    renderObj.image.20.maxW = 100
}

Your solution works as well

Dimitri L.
  • 4,499
  • 1
  • 15
  • 19