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

Bernd Wilke t3n at pi-phi.de
Wed Mar 16 08:34:20 CET 2016


Am 15.03.2016 um 11:40 schrieb Hagen Gebauer:
> Hi Bernd,
>
> thanks a lot for your reply. Regrettably I don't understand how to use
> this information. I unsuccessfully tried several ways in TypoScript.
> What I want to achieve is to use all image data (publicUrl, title,
> description) in the template file that is already being called
> (TextBgPic.html). And it should at best be just one database request for
> all the image information.
>
> The CE is basically a copy of the standard CE "Text & Images" (textpic).
> In another extension I wrote, I could easily access all information on
> an image in the template by the property name of the image(s) (the
> database field that stores how many images are linked to the record,
> just as the "image" field in tt_content) in the way
> image.originalResource.[publicUrl/title/...]
>

lets have a picture of the data:
+---------------------------------+
| data (tt_content)               |
|  +----+ +----+ +----+           |
|  |img1| |img2| |img3|           |
|  +----+ +----+ +----+           |
+---------------------------------+

in the same way you should template the data

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 = FLUIDTEMPLATE
             renderObj {
                 file = 
EXT:my_extension/Resources/Private/Templates/Image.html
             }
         }
     }
}

and in EXT:my_extension/Resources/Private/Templates/Image.html you have 
access to all data of one image: (uid (sys_file), publicUrl, width, 
height, description, title, ...
explore by using: <f:debug title="one image">{_all}</f:debug>

bernd


More information about the TYPO3-english mailing list