---
title: "gallery data processor"
manual: "TypoScript Explained"
version: "13.4"
permalink: "https://docs.typo3.org/permalink/t3tsref:galleryprocessor@13.4"
source: "DataProcessing/GalleryProcessor.rst"
rendered: "2026-09-28T13:42:24+00:00"
---

# `gallery` data processor {#galleryprocessor}

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](https://docs.typo3.org/permalink/t3tsref:filesprocessor@13.4) can
be used to fetch the files.

**Table of contents**

-   [Options:](https://docs.typo3.org/permalink/t3tsref:options@13.4)
-   [Example: display images in rows and columns](https://docs.typo3.org/permalink/t3tsref:example-display-images-in-rows-and-columns@13.4)

## Options: {#galleryprocessor-options}

**if**

-   **if**

    -   *Type:* [if](https://docs.typo3.org/permalink/t3tsref:if@13.4) condition
    -   *Default:* ''

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

**filesProcessedDataKey**

-   **filesProcessedDataKey**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 'files'
    -   *Example:* 'myImages'

    Key of the array previously processed by the
    `\TYPO3\CMS\Frontend\DataProcessing\FilesProcessor`.

**numberOfColumns**

-   **numberOfColumns**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *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](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *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.

    ![Screenshot of the image settings as found in the TYPO3 backend when editing an image](../Images/ManualScreenshots/Fluidtemplate/ImageOrientation.png)

**maxGalleryWidth**

-   **maxGalleryWidth**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 600

    Maximal gallery width in pixels.

**maxGalleryWidthInText**

-   **maxGalleryWidthInText**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 300

    Maximal gallery width in pixels if displayed in a text.

**equalMediaHeight, equalMediaWidth**

-   **equalMediaHeight, equalMediaWidth**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *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.

    ![Screenshots of Media Adjustments in the TYPO3 backend](../Images/ManualScreenshots/Fluidtemplate/MediaHeight.png)

**columnSpacing**

-   **columnSpacing**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 0
    -   *Example:* 4

    Space between columns in pixels

**borderEnabled**

-   **borderEnabled**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *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](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 0
    -   *Example:* 2

    Width of the border in pixels.

**borderPadding**

-   **borderPadding**

    -   *Type:* [integer](https://docs.typo3.org/permalink/t3tsref:data-type-integer@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* 0
    -   *Example:* 20

    Padding around the border in pixels.

**cropVariant**

-   **cropVariant**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* "default"
    -   *Example:* "mobile"

    See [crop variants in the TCA reference](https://docs.typo3.org/m/typo3/reference-tca/13.4/en-us/ColumnsConfig/Type/ImageManipulation/Index.html#columns-imageManipulation-properties-cropVariants)

**as**

-   **as**

    -   *Type:* [string](https://docs.typo3.org/permalink/t3tsref:data-type-string@13.4) / [stdWrap](https://docs.typo3.org/permalink/t3tsref:stdwrap@13.4)
    -   *Default:* "files"

    The variable name to be used in the Fluid template.

**dataProcessing**

-   **dataProcessing**

    -   *Type:* array of [Data processors](https://docs.typo3.org/permalink/t3tsref:dataprocessing@13.4)
    -   *Default:* \[\]

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

## Example: display images in rows and columns {#galleryprocessor-example-rows-columns}

Please see also [About the examples](https://docs.typo3.org/permalink/t3tsref:dataprocessing-about-examples@13.4).

**TypoScript**

As the `\TYPO3\CMS\Frontend\DataProcessing\GalleryProcessor` expects
the data of the files to be present in the the `processedData` array, the
`\TYPO3\CMS\Frontend\DataProcessing\FilesProcessor` always has to be
called first. Execution depends on the key in the
[dataProcessing](https://docs.typo3.org/permalink/t3tsref:galleryprocessor-dataprocessing@13.4) array, not the order in
which they are put there.

The content of
[filesProcessedDataKey](https://docs.typo3.org/permalink/t3tsref:galleryprocessor-filesprocesseddatakey@13.4) in the
`\TYPO3\CMS\Frontend\DataProcessing\GalleryProcessor` has to be equal
to the content of [as](https://docs.typo3.org/permalink/t3tsref:filesprocessor-as@13.4) in the
[FilesProcessor](https://docs.typo3.org/permalink/t3tsref:filesprocessor@13.4):

![Output of a GalleryProcessor, including debug output](../Images/ManualScreenshots/DataProcessing/GalleryProcessor.png)

**The Fluid template**

**EXT:examples/Resources/Private/Templates/ContentElements/DataProcGallery.html**

```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>

```

**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](../Images/ManualScreenshots/FrontendOutput/DataProcessing/GalleryProcessor.png)
