4

Page's Resources Tab

I have been trying to access these files but with no luck. Any help is appreciated.

Santiago Degetau
  • 356
  • 4
  • 14

2 Answers2

9

If your system has EXT:vhs installed you can get this via vhs viewhelper like this,

{namespace v=FluidTYPO3\Vhs\ViewHelpers}

<v:page.resources.fal table="pages" field="media" uid="{page.uid}" as="images" slide="-1" >
    <f:for each="{images}" as="image">
        <f:image src="{image.url}" alt="{image.alternative} {image.name}" title="{image.title}" />
    </f:for>
</v:page.resources.fal>

you can get more about this from here: https://github.com/FluidTYPO3/vhs/pull/395 and https://fluidtypo3.org/viewhelpers/vhs/2.3.3/Page/Resources/FalViewHelper.html#argument-slide

You can use typoscrpt solution as well,

lib.pageResources = FILES 
lib.pageResources { 
    references { 
        table = pages 
        uid.data = uid
        fieldName = media
    } 
    renderObj = IMAGE 
    renderObj {
        file { 
            import.data = file:current:uid 
            treatIdAsReference = 1 
            width = 150c 
            height = 150c 
        } 
        altText.data = file:current:alternative
        titleText.data = file:current:title
    }
    maxItems = 3
}

Render this with:

<f:cObject typoscriptObjectPath="lib.pageResources" />

You can get more about this from here: https://riptutorial.com/typo3/example/21734/image-and-image-resource

Hope this helps you... #KeepCoding.. ;)

Regards

Geee
  • 2,217
  • 15
  • 30
3

To access the Page Resources files / image in the TYPO3 Fluid, take this example:

<f:if condition="{files}">
    <f:then>
        <f:for each="{files}" as="image">
            <f:uri.image image="{image}" />
        </f:for>
    </f:then>
</f:if>

all the Page Resources files / images find you in the "files". take the <f:debug>{_all}</f:debug>

Scopestyle
  • 643
  • 5
  • 18
Sebastian
  • 883
  • 11
  • 32
  • This is the best answer as of now, no vhs, no typoscript anymore - plus the possibility to access image.properties.title & image.properties.description – mtness Feb 20 '23 at 21:11