Image rendering
FileUtility
File rendering in EXT: is handled by File, which by
default renders the following JSON for each file:
{
"publicUrl": "https://www.example.org/fileadmin/_processed_/6/c/csm_my-image_51125112.jpg",
"properties": {
"mimeType": "image/jpeg",
"type": "image",
"filename": "csm_my-image_51125112.jpg",
"link": null,
"linkData": null,
"originalUrl": "https://www.example.org/fileadmin/my-image.jpg",
"uidLocal": "123",
"fileReferenceUid": 234,
"size": "50 KB",
"title": null,
"alternative": null,
"description": null,
"dimensions": {
"width": "300",
"height": "100"
},
"cropDimensions": {
"width": 300,
"height": 100
},
"crop": null,
"autoplay": null,
"extension": "jpg"
}
}
crop holds the reference's raw crop configuration — a JSON string, or
null when none is set.
Set legacy in the processing configuration for the simplified
shape:
page.10.fields.ogImage = TEXT
page.10.fields.ogImage {
dataProcessing {
10 = headless-files
10 {
as = media
references.fieldName = og_image
processingConfiguration {
legacyReturn = 0
}
}
}
}
Each file in the resulting list becomes:
{
"url": "https://www.example.org/fileadmin/_processed_/6/c/csm_my-image_51125112.jpg",
"mimeType": "image/jpeg",
"type": "image",
"filename": "csm_my-image_51125112.jpg",
"originalUrl": "https://www.example.org/fileadmin/my-image.jpg",
"link": null,
"uidLocal": "123",
"fileReferenceUid": 234,
"size": "50 KB",
"title": null,
"alternative": null,
"description": null,
"dimensions": {
"width": "300",
"height": "100"
},
"cropDimensions": {
"width": 300,
"height": 100
},
"cropVariants": { "default": "..." },
"autoplay": null,
"extension": "jpg"
}
crop only appears for images whose crop configuration
defines more than one crop variant.
To add custom keys to this payload (signed URLs, focus point, …), listen to
\Friends — see
Events you can listen to.
FilesProcessor
EXT: provides its own Files to render files; its
sources (references, files, collections, folders) and generic
options are listed in FilesProcessor. The example
above shows how the og_ of a page is rendered.
Processing configuration
The processing block accepts these options:
legacy(0|1, default 1) —Return 1renders the legacy shape,0the simplified one shown above.link(0|1) — only withResult legacy: return the wholeReturn = 0 Linkobject of the file link asResult linkinstead of its URL.cache(0|1) — appendBusting ?<modification_to every file URL, except YouTube and Vimeo media (enabled globally by thedate> headless.feature flag).assets Cache Busting width,height,min,Width min,Height max,Width max— image processing instructions passed to the core processor.Height crop(name, defaultVariant default) — render a specific crop variant.process(0|1, default 0) — process GIF files.Gif output(0|1) — add the crop configuration asCrop Area cropto eachcropentry.Variants conditional(0|1) — skip crop variants whose crop area is empty.Crop Variant
include (0|1): add an original node (url, autogenerated urls and dimensions) with the uncropped image next to crop, also when a default crop variant exists
`processPdfAsImage` (0|1, default 0) — process PDF files as images.
process (0|1, default 0) — process SVG files.
`properties.byType` (0|1) — filter file properties by type (no video
properties on images).
properties. (comma list) — default fields when
properties. is enabled.
`properties.defaultImageFields` (comma list) — default fields for images
when `properties.byType` is enabled.
properties. (comma list) — default fields for videos
when properties. is enabled.
`properties.includeOnly` (comma list) — file properties to return.
properties. (0|1) — flatten nested properties (the dimensions
array) for use with properties..
`returnFlattenObject` (0|1) — return a single file object instead of an
array; for fields that hold one file.
delay (0|1) — skip processing and only collect the files, so
that the next processor (usually Gallery) processes them.
`fileExtension` — convert images to another format, e.g. `webp`.
autogenerate — additional renditions per image, each rendered at the
target width/height times a factor (capped at the original size) and
emitted as a URL string next to the file's own URL:
retina2x = 1— factor 2, emitted asurl.Retina lqip = 1— factor 0.1, emitted asurl.Lqip - custom keys with
factorand optionalfile, emitted under the key's name, see the example below.Extension
10 = headless-files
10 {
references.fieldName = image
as = files
processingConfiguration {
delayProcessing = 1
}
}
20 = headless-gallery
20 {
...
autogenerate {
retina2x = 1
customFileWebp {
fileExtension = webp
factor = 1.0
}
customTinyJpg {
fileExtension = jpg
factor = 0.2
}
}
}
10 = headless-files
10 {
...
processingConfiguration {
# (1 by default = legacy output; set 0 for the new simplified format)
legacyReturn = 0
# Return whole LinkResult object instead simple url
linkResult = 1
# skip crop variants whose crop area is empty
conditionalCropVariant = 1
# Generate cacheBusting urls for images and video files
cacheBusting = 1
properties {
# return props by mimeType
byType = 1
# return only properties defined below
includeOnly = alternative,width,height
# you can also alias fields
# includeOnly = alternative as alt,width,height
# with includeOnly you can use option `flatten` to flatten dimensions array
flatten = 1
}
}
}
GalleryProcessor
The EXT: Gallery extends the core one and processes
the files a preceding Files collected with
delay. It reads them from files
(default files), so set as = files on the Files — its own
default as is media — as in the example above and the shipped
lib..
The rendering configuration is set directly on the processor: all
options of the processing block documented above
(legacy, file, crop, autogenerate, …) are
read from the processor's top-level configuration — there is no
processing sub-key. These options are read as plain
values, without stdWrap.
Note
legacy must have the same value on the Files and
the Gallery: the gallery reads the collected files in the
shape its own legacy describes.
The core gallery options (media, number,
equal, equal, border, …) work as in
the core processor. The shipped lib. sets the
following from EXT: constants
(Configuration/TypoScript/constants.typoscript):
max:Gallery Width {$styles.content. textmedia. max W} max:Gallery Width In Text {$styles.content. textmedia. max WIn Text} column:Spacing {$styles.content. textmedia. column Spacing} border:Width {$styles.content. textmedia. border Width} border:Padding {$styles.content. textmedia. border Padding}