This key defines the options for files uploaded to an entry, using the same keys as the options of a File Input. An Input that lists this entry in options.allowed_sources uses these as defaults.
Appears in#
└── assets_config
└── *
└── optionsType#
Object
Properties#
This key defines which file types are available to select or upload to this input.
Accepted format is an array or comma-separated string of MIME types.
The special value "*" means any type is accepted.
Appears in: URL Input options, File Input options, *.options.
Show examplesHide examples
In this example, we have configured a Image Input to accept only JPEG or PNG files.
_inputs:
featured_image:
type: image
options:
accepts_mime_types:
- image/jpeg
- image/png{
"_inputs": {
"featured_image": {
"type": "image",
"options": {
"accepts_mime_types": [
"image/jpeg",
"image/png"
]
}
}
}
}This key defines whether you can upscale an image to fit the bounding box while resizing an image prior to upload.
Has no effect if files are not resized.
Defaults to: false
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.image, *.options.
Show examplesHide examples
In this example, we have configured an Image Input to allow upscaling images to fit the bounding box while resizing.
_inputs:
hero_image:
type: image
options:
width: 1200
height: 600
resize_style: cover
expandable: true{
"_inputs": {
"hero_image": {
"type": "image",
"options": {
"width": 1200,
"height": 600,
"resize_style": "cover",
"expandable": true
}
}
}
}This key defines the height of the bounding box used in the resizing method defined by resize_style.
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.image, *.options.
Show examplesHide examples
In this example, we have configured the height of the bounding box for an Image Input.
_inputs:
hero_image:
type: image
options:
width: 1200
height: 600
resize_style: cover{
"_inputs": {
"hero_image": {
"type": "image",
"options": {
"width": 1200,
"height": 600,
"resize_style": "cover"
}
}
}
}This key defines the maximum file size in kB that CloudCannon will allow you to upload.
When configured, CloudCannon will prevent you from saving your changes until you select a valid file size, or discard your unsaved changes.
Value can be any positive integer.
This key has no default.
This key is available for File and URL Inputs.
Appears in: URL Input options, File Input options, *.options.
Show examplesHide examples
In this example, we want our team to upload an image using the feature_image Input. This Input limits you to a maximum file size of 750 kB.
_inputs:
feature_image:
type: image
comment: Select the feature image for the banner.
options:
max_file_size: 750{
"_inputs": {
"feature_image": {
"type": "image",
"comment": "Select the feature image for the banner.",
"options": {
"max_file_size": 750
}
}
}
}This key defines a custom error message that explains why a value has failed the validation criteria from options.max_file_size.
This key requires you to define options.max_file_size.
This key has no default.
This key is available for File and URL Inputs.
Appears in: URL Input options, File Input options, *.options.
Show examplesHide examples
In this example, we want our team to upload an image using the feature_image Input. This Input limits you to a maximum file size of 750 kB.
_inputs:
feature_image:
type: image
comment: Select the feature image for the banner.
options:
max_file_size: 750
max_file_size_message: For SEO, keep this under 750kB{
"_inputs": {
"feature_image": {
"type": "image",
"comment": "Select the feature image for the banner.",
"options": {
"max_file_size": 750,
"max_file_size_message": "For SEO, keep this under 750kB"
}
}
}
}This key defines what format an image is converted to prior to upload.
Allowed values: image/jpeg image/png image/webp
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.image, *.options.
Show examplesHide examples
In this example, we have configured an Image Input to convert images to WebP format prior to upload.
_inputs:
hero_image:
type: image
options:
mime_type: image/webp{
"_inputs": {
"hero_image": {
"type": "image",
"options": {
"mime_type": "image/webp"
}
}
}
}This key defines paths for your Rich Text editors or File inputs.
If undefined at higher levels of the configuration cascade, paths will default to any
values configured in the CloudCannon configuration file.
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.link, _editables.image, _editables.text, *.options.
Show examplesHide examples
In this example, we have configured paths for the blog Collection to set custom upload and static paths.
collections_config:
blog:
paths:
uploads: /uploads/blog/
static: /assets/{
"collections_config": {
"blog": {
"paths": {
"uploads": "/uploads/blog/",
"static": "/assets/"
}
}
}
}This key defines how image files are resized prior to upload, using a bounding box defined by width and height options (these optionas are required). This key applies to existing images unless prevent_resize_existing_files is set.
Setting this key to cover keeps aspect ratio and ensures the image covers the bounding box, contain keeps aspect ratio and ensures the image fits inside the bounding box, crop prompts the user with an interface to select an aspect-ratio-respecting area, and stretch ignores aspect ratio and resizes the image to the bounding box.
Defaults to: contain
Allowed values: cover contain stretch crop
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.image, *.options.
Show examplesHide examples
In this example, we have configured an Image Input to resize images using the cover style to ensure images cover the bounding box while maintaining aspect ratio.
_inputs:
hero_image:
type: image
options:
width: 1200
height: 600
resize_style: cover{
"_inputs": {
"hero_image": {
"type": "image",
"options": {
"width": 1200,
"height": 600,
"resize_style": "cover"
}
}
}
}This key defines the width of the bounding box used in the resizing method defined by resize_style.
Appears in: Rich Text Input options, URL Input options, File Input options, _editables.content, _editables.block, _editables.image, *.options.