This article covers a Bloomreach Experience Manager version 13. There's an updated version available that covers our most recent release.

Image and asset upload validation

Description

Uploaded files can be validated before they are processed. This means validating properties like file size and file extension or more specific ones like image resolution.

The validation services are used in the following sections:

  • GalleryWorkflowPlugin: this plugin takes care of uploading image/asset files to a image/asset folder via the context menu "Add image"/"Add file".
  • ImageUploadPlugin/ResourceUploadPlugin: these plugins are used to upload an image variant (e.g. thumnail variant) or an asset file when editing an image/asset.
  • The image picker dialog in the CKEditor: uploading file via the image picker will be validated by the image validation service.

By default, the file upload plugin will try to load an instance of the org.hippoecm.frontend.plugins.yui.upload.validation.FileUploadValidationService by looking up a service specified by property validator.id. If no specific service is found, the DefaultUploadValidationService is used.

Configuration

The DefaultUploadValidationService will validate file size and file extension(s). It can be configured at /hippo:configuration/hippo:frontend/cms/cms-services/assetValidationService.

Property Type Description Default value
max.file.size

String

Maximum file size allowed per file. The value is converted using Wicket's Bytes.valueOf()

10mb
extensions.allowed

String multiple

File extensions allowed. Values are configured as *.jpg, *.png, etc. Leave blank for all extensions.

 
mimetypes.allowed 
(since CMS 4.0.2)

String multiple

Mime types allowed.
For the configured values like image/tiff, validation of the upload's mime type against the actual upload stream is skipped. This can be helpful if the validation doesn't work for unusual types like TIFF or RAW.

 

The ImageUploadValidationService extends the DefaultUploadValidationService and adds validation of the image resolution as well as more image specific default values.

It is located at /hippo:configuration/hippo:frontend/cms/cms-services/imageValidationService.

Property Type Description Default value
max.file.size

String

Maximum file size allowed per file. The value is converted using Wicket's Bytes.valueOf()

4mb
extensions.allowed

String multiple

File extensions allowed. Values are configured as *.jpg, *.png, etc. Leave blank for all extensions.

*.jpg, *.jpeg, *.gif, *.png
mimetypes.allowed 
(since CMS 4.0.2)

String multiple

Mime types allowed.
For the configured values like image/tiff, validation of the upload's mime type against the actual upload stream is skipped. This can be helpful if the validation doesn't work for unusual types like TIFF or RAW.

 

max.width

Long

Maximum horizontal number of pixels allowed.

1920

max.height

Long

Maximum vertical number of pixels allowed.

1280

 Currently only the following image formats are supported for upload: JPEG, GIF, PNG, SVG, BMP, PCX, IFF, RAS, PBM, PGM, PPM and PSD.
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?