Skip to content

Instantly share code, notes, and snippets.

@slackero
Created April 23, 2024 05:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slackero/a3d88890c2aa824c470f92d350f2f764 to your computer and use it in GitHub Desktop.
Save slackero/a3d88890c2aa824c470f92d350f2f764 to your computer and use it in GitHub Desktop.
Typo3 bootstrap_package get the thumbnail image from the page details
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:v="http://typo3.org/ns/FluidTYPO3/Vhs/ViewHelpers" data-namespace-typo3-fluid="true">
<f:if condition="{pageThumbnails}">
<f:for each="{pageThumbnails}" as="thumbnail" iteration="iteration">
<f:if condition="{iteration.isFirst}">
<div class="container-border">
<f:comment><f:image src="{thumbnail.data.uid}" treatIdAsReference="1" class="img-fluid" /></f:comment>
<v:media.image
src="{thumbnail.data.uid}"
treatIdAsReference="1"
alt="{thumbnail.data.alternative}"
class="img-fluid w-100 d-block"
srcset="320, 768, 990, 1200, 1920"
srcsetDefault="768"
/>
</div>
</f:if>
</f:for>
</f:if>
</html>
page.10.dataProcessing {
# Get the thumbnail image of the page if available (Typo3 12.4)
100 = database-query
// older versions might require (untested)
// 100 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
100 {
table = sys_file_reference
as = pageThumbnails
// sys_file_reference.title, sys_file_reference.description, sys_file_reference.alternative, sys_file_reference.link, sys_file_reference.crop
selectFields = sys_file_reference.uid, sys_file_reference.uid_local, sys_file_reference.title, sys_file_reference.description, sys_file_reference.alternative, sys_file_reference.link
where = sys_file_reference.tablenames = 'pages' AND sys_file_reference.fieldname = 'thumbnail'
join = pages ON pages.uid = sys_file_reference.uid_foreign AND pages.thumbnail = 1
}
}
@slackero
Copy link
Author

You will need to have the extension VHS: Fluid ViewHelpers installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment