Search code examples
fluidtypo3-6.2.x

Can't fetch image url to use in my fluid image viewhelper


I have a problem with fetching an image url to use in my fluid view helper:

My view helper looks like this:

<f:image src="{f:cObject(typoscriptObjectPath:'plugin.tx_contentelements.slidePath', data:'{data.uid}')}" class="slideshow-image" alt="{data.header}" />

and my TS looks like this:

plugin.tx_contentelements.slidePath = FILES
plugin.tx_contentelements.slidePath {
  references {
    table = tt_content
    uid.data = uid
    fieldName = image
  }
  begin = 0
  maxItems = 1

  renderObj = IMG_RESOURCE
  renderObj {
    file {
        import.data = file:current:uid
        treatIdAsReference = 1
        width = 900
    }
  }
}

the problem is probably the uid.data = uid. I saw this in an example, but it does not seem to work for me.


Solution

  • hmm untested but have you tried this? ...uid.field instead of uid.data... or you do it like this: uid.data = field:uid

    plugin.tx_contentelements.slidePath {
      references {
        table = tt_content
        uid.field = uid
        fieldName = image
      }
    

    maybe it helps