TYPO3 Logo
TypoScript Explained
Options
Give feedback View source How to edit Edit on GitHub Full documentation (single file)

TypoScript Explained

About TypoScript

  • Introduction
  • Getting started
    • Quick overview
    • First steps
    • Page
    • Content records
    • Create a menu with TypoScript
    • fluid_styled_content
    • TypoScript objects
      • Objects executing database queries
      • Objects rendering content
      • Further objects
    • TypoScript functions
      • stdWrap
      • getText / data
      • imgResource
      • select
      • split
      • if
      • typolink
      • parseFunc
    • Next steps
  • Usage
    • TypoScript in Sites
    • TypoScript in Extensions
    • Backend Module
    • Access TypoScript in an extension
    • Constants
    • Register
    • Debugging / analyzing
  • Using and setting TSconfig
    • Setting page TSconfig
    • Setting user TSconfig
    • Conditions
    • PHP API
  • Syntax
    • Identifiers
    • Code blocks
    • Operators
    • Comments
    • Conditions
    • File imports
    • String formats
    • TSconfig differences

Frontend TypoScript

  • Page
    • PAGE Examples
  • Content Objects (cObject)
    • Content objects (general information)
    • CASE
    • Content object array - COA, COA_INT
    • CONTENT
    • EXTBASEPLUGIN
    • FILES
    • FLUIDTEMPLATE
    • HMENU
      • TMENU
        • TMENUITEM
    • IMAGE
      • GIFBUILDER
        • Examples
        • Colors in TypoScript GIFBUILDER
        • Note on (+calc)
        • Properties
        • GIFBUILDER objects
          • ADJUST
          • BOX
          • CROP
          • EFFECT
          • ELLIPSE
          • EMBOSS
          • IMAGE
          • OUTLINE
          • SCALE
          • SHADOW
          • TEXT
          • WORKAREA
    • IMG_RESOURCE
    • LOAD_REGISTER
    • PAGEVIEW
    • RECORDS
    • RESTORE_REGISTER
    • SVG
    • TEXT
    • USER and USER_INT
  • Data processors
    • comma-separated-value
    • database-query
    • files
    • flex-form
    • gallery
    • language-menu
    • menu
      • Browse
      • Categories
      • Directory
      • Keywords
      • Language
      • List
      • Rootline / Breadcrumb
      • Updated
      • Userfunction
    • page-content
    • record-transformation
    • site
    • site-language
    • split
    • Custom data processors
  • Config
  • Top-level objects
    • page & config
    • module
    • plugin
    • Reserved top-level objects
  • Functions
    • cache
    • Calc
    • Data / getText
    • encapsLines
    • getEnv
    • HTMLparser
    • HTMLparser_tags
    • if
    • imageLinkWrap
    • imgResource
    • makelinks
    • numberFormat
    • numRows
    • optionSplit
    • parseFunc
    • replacement
    • round
    • select
    • split
    • stdWrap
    • strPad
    • tags
    • typolink
    • Wrap
  • Conditions

Backend TypoScript

  • Page TSconfig Reference
    • colorPalettes
    • mod
      • SHARED
      • web_info
      • web_layout
        • Backend layouts
      • web_list
      • web_view
      • wizards
    • options
    • RTE
    • TCAdefaults
    • TCEFORM
    • TCEMAIN
    • templates
    • tx_*
  • User TSconfig reference
    • admPanel (EXT:adminpanel)
    • auth
    • options
    • page
    • permissions
    • setup
    • TCAdefaults
    • tx_*

Appendix

  • PHP and TypoScript
  • Glossary
  • Sitemap
  1. TypoScript Explained
  2. Data processors
  3. gallery
Give feedback Edit on GitHub

gallery data processor

The \TYPO3\CMS\Frontend\DataProcessing\GalleryProcessor , alias gallery, provides the logic for working with galleries and calculates the maximum asset size. It uses the files already present in the processedData array for its calculations. The files data processor can be used to fetch the files.

Table of contents

  • Options:
  • Example: display images in rows and columns

Options:

Name Type Default
if
if condition ''
filesProcessedDataKey
string / stdWrap 'files'
numberOfColumns
integer / stdWrap field:imagecols
mediaOrientation
integer / stdWrap field:imageorient
maxGalleryWidth
integer / stdWrap 600
maxGalleryWidthInText
integer / stdWrap 300
equalMediaHeight, equalMediaWidth
integer / stdWrap field:imageheight, field:imagewidth
columnSpacing
integer / stdWrap 0
borderEnabled
integer / stdWrap field:imageborder
borderWidth
integer / stdWrap 0
borderPadding
integer / stdWrap 0
cropVariant
string / stdWrap "default"
as
string / stdWrap "files"
dataProcessing
array of Data processors []

if

if
Type
if condition
Required
false
Default
''

Only if the condition is met the data processor is executed.

filesProcessedDataKey

filesProcessedDataKey
Type
string / stdWrap
Required
true
Default
'files'
Example
'myImages'

Key of the array previously processed by the FilesProcessor.

numberOfColumns

numberOfColumns
Type
integer / stdWrap
Required
false
Default
field:imagecols
Example
4

Expects the desired number of columns. Defaults to the value of the field imagecols (Number of Columns) if used with content elements.

mediaOrientation

mediaOrientation
Type
integer / stdWrap
Required
false
Default
field:imageorient
Example
2

Expects the image orientation as used in the field imageorient in content elements such as text with images. Defaults to the value of the field imageorient (Position and Alignment) if used with content elements.

Media orientation Palette

Media orientation in the content elements such as text with images

maxGalleryWidth

maxGalleryWidth
Type
integer / stdWrap
Required
false
Default
600

Maximal gallery width in pixels.

maxGalleryWidthInText

maxGalleryWidthInText
Type
integer / stdWrap
Required
false
Default
300

Maximal gallery width in pixels if displayed in a text.

equalMediaHeight, equalMediaWidth

equalMediaHeight, equalMediaWidth
Type
integer / stdWrap
Required
false
Default
field:imageheight, field:imagewidth
Example
300

If set all images get scaled to a uniform height / width. Defaults to the value of the fields imageheight (Height of each element (px)), imagewidth (Width of each element (px)) if used with content elements.

Media height and width in the content element Text and Images

Media height and width in the content element Text and Images

columnSpacing

columnSpacing
Type
integer / stdWrap
Required
false
Default
0
Example
4

Space between columns in pixels

borderEnabled

borderEnabled
Type
integer / stdWrap
Required
false
Default
field:imageborder
Example
1

Should there be a border around the images? Defaults to the value of the fields imageborder (Number of Columns) if used with content elements.

borderWidth

borderWidth
Type
integer / stdWrap
Required
false
Default
0
Example
2

Width of the border in pixels.

borderPadding

borderPadding
Type
integer / stdWrap
Required
false
Default
0
Example
20

Padding around the border in pixels.

cropVariant

cropVariant
Type
string / stdWrap
Required
false
Default
"default"
Example
"mobile"

See crop variants in the TCA reference

as

as
Type
string / stdWrap
Required
false
Default
"files"

The variable name to be used in the Fluid template.

dataProcessing

dataProcessing
Type
array of Data processors
Required
false
Default
[]

Array of data processors to be applied to all fetched records.

Example: display images in rows and columns

Please see also About the examples.

TypoScript

As the GalleryProcessor expects the data of the files to be present in the the processedData array, the FilesProcessor always has to be called first. Execution depends on the key in the dataProcessing array, not the order in which they are put there.

The content of filesProcessedDataKey in the GalleryProcessor has to be equal to the content of as in the FilesProcessor:

EXT:examples/Configuration/TypoScript/DataProcessors/Processors/GalleryProcessor.typoscript
tt_content {
    examples_dataprocgallery =< lib.contentElement
    examples_dataprocgallery {
        templateName = DataProcGallery
        dataProcessing {
            # Process files
            10 = files
            10 {
                as = images
                references.fieldName = image
                references.table = tt_content
                sorting = title
                sorting.direction = descending
            }

            # Calculate gallery info
            20 = gallery
            20 {
                filesProcessedDataKey = images
                mediaOrientation.field = imageorient
                numberOfColumns = 4
                equalMediaHeight.field = imageheight
                equalMediaWidth.field = imagewidth
                maxGalleryWidth = 1000
                maxGalleryWidthInText = 1000
                columnSpacing = 0
                borderEnabled.field = imageborder
                borderWidth = 5
                borderPadding = 3
                as = gallery
            }
        }
    }
}
Copied!
The Fluid template
EXT:examples/Resources/Private/Templates/ContentElements/DataProcGallery.html
<html data-namespace-typo3-fluid="true" xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">
   <h2>Data in variable gallery</h2>
   <f:debug inline="true">{gallery}</f:debug>

   <h2>Output</h2>
   <f:for each="{gallery.rows}" as="row">
      <div class="row">
         <f:for each="{row.columns}" as="column">
            <f:if condition="{column.media}">
               <div class="col-auto p-{gallery.border.padding}">
                  <f:image image="{column.media}" width="{column.dimensions.width}"
                           class="{f:if(condition: '{gallery.border.enabled}',
                              then:'border border-success rounded')}"
                           style="border-width: {gallery.border.width}px!important;"/>
               </div>
            </f:if>
         </f:for>
      </div>
   </f:for>

</html>
Copied!
Output

The array now contains the images ordered in rows and columns. For each image there is a desired width and height supplied.

Gallery dump and output
  • Previous
  • Next
Reference to the headline

Copy and freely share the link

This link target has no permanent anchor assigned. You can make a pull request on GitHub to suggest an anchor. The link below can be used, but is prone to change if the page gets moved.

Copy this link into your TYPO3 manual.

  • Home
  • Contact
  • Issues
  • Repository

Last rendered: May 18, 2025 11:08

© since 2012 by the TYPO3 contributors
  • Legal Notice
  • Privacy Policy