Skip to content

Image Field ​

The same as File, narrowed to pictures — and the form shows a preview instead of a file name.

Settings: source and file path, as for a file, plus control over the saved name:

SettingWhat it does
Filename on uploadKeep the original, transliterate it, generate a random one, use the date, or build it from a pattern
Filename prefixPrepended to the result
Filename patternThe template, when the strategy is "pattern"

Automatic conversion ​

An uploaded picture is converted and recompressed on the spot — nothing to switch on per field. Three system settings decide how:

SettingDefaultWhat it does
pageblocks_image_formatwebpTarget format. Empty or none turns conversion off
pageblocks_image_quality82Compression quality
pageblocks_image_max_width0Shrink anything wider than this; 0 keeps the original width

So by default a JPEG uploaded into the field is stored as WebP, and that is the extension the value carries. SVG is left alone, and a conversion that fails keeps the original file rather than losing it.

Output:

html
<img src="/{$image.url}"
     width="{$image.width}"
     height="{$image.height}"
     alt="{$image.title}">

Transliteration is worth turning on

An uploaded file keeps its original name by default, and originals arrive named in the editor's language, with spaces and brackets. Such a name survives on disk but complicates everything downstream — links, caches, CDNs. Transliteration costs one setting.

© PageBlocks 2019-present