[TYPO3-english] TypoScript/Fluid: get image title and description

Bernd Wilke t3n at pi-phi.de
Tue Mar 15 10:06:35 CET 2016


Am 14.03.2016 um 09:59 schrieb Hagen Gebauer:
> Hi everybody,
>
> I have created my own content elements in order to use FAL images from
> tt_content.image as a background image. It works pretty well. But I want
> to add a small box with the image's title and description. I've been
> trying for days to find a solution. My TypoScript for the content
> element is
>
> tt_content.text_bgpic = FLUIDTEMPLATE
> tt_content.text_bgpic {
>      file =
> EXT:my_extension/Resources/Private/Templates/Content/TextBgPic.html
>      variables {
>          imagePath = FILES
>          imagePath {
>              references {
>                  table = tt_content
>                  fieldName = image
>              }
>              renderObj = IMG_RESOURCE
>              renderObj {
>                  file.import.data = file:current:publicUrl
>                  file.treatIdAsReference = 1
>              }
>          }
>      }
> }
>
> In the Fluid template I can easily access the image path by {imagePath}
> set in the above TypoScript while every other data from the tt_content
> record is accessed by {data.[fieldname]} (e.g. {data.bodytext})
>
> I tried several ways in the Fluid Template (like
> data.image.originalResource.title, with and without "data" and/or
> "originalResource"). And I found absolutely no way to set respective
> variables in the TypoScript (like imageTitle or imagePath.title or
> whatever)

you already have the imagePath. in the same way you could access the 
other data. but not so easy in the fluid but in typoscript.

you might change the renderObj. if you want to do the rendering of one 
image with fluid you might chnage the renderObj to FLUID_TEMPLATE and 
then you can access all data of one image in that template.

bernd



More information about the TYPO3-english mailing list