Image Fields
A dedicated file input that stores the URL or path of an uploaded image.
It supports external media library integration, but also repo-based media configurations.
Images can be uploaded to the image component with drag-and-drop actions, or with the dedicated media manager that comes with the CMS.
To modify which types of files can be uploaded to the media manager, find the list of supported file types and how to override the default accepted media types
Type Definition
For additional properties common to all Field types, check the Field type definition.
Set this to "image" to use the Image Field.
The name of the field for internal use.
Restricts the field to specific file types. Takes an extension ("pdf"), a category ("image", "video", "audio" or "document"), or an array of either.
All properties marked as REQUIRED must be specified for the field to work properly.
Example
Simple field
Field with image path formatting
If you need to customize how an image is formatted in a field, you can use the format & parse options.
Restricting file types
Set accept to limit the field to certain file types. It takes a single extension, a category, or an array of either.
The four categories are shorthand for a group of extensions:
Category | Extensions |
|---|---|
|
|
|
|
|
|
|
|
When a field declares accept:
- The media manager lists only matching files, and its type filter is replaced by a locked chip naming what the field takes.
- A file of any other type is refused before it uploads, whether it is dropped on the field or on the media manager, so nothing unwanted lands in your library.
- Choosing a file already in the library that doesn't match raises an alert and leaves the field's value untouched.
jpgandjpegmean the same thing, soaccept: 'jpeg'still takesphoto.jpg.- The field's
acceptoverrides the globalmedia.acceptfor this field only.
Values saved before accept was added are left alone; the restriction applies to what an editor picks from now on. It applies to list: true image fields too.
Narrowing the library needs a media store that can filter by extension. Repo-based media, TinaCloud media and the local dev server all can. A store that can't, such asstaticMedia, keeps listing everything and hides the filter control, but the field still refuses a file outside its types.