Validate images and videos based on their width and height values.

import { defineFilePond } from 'filepond';
import { locale } from 'filepond/locales/en-gb.js';
import { MediaResolutionValidator } from 'filepond/extensions/media-resolution-validator.js';

defineFilePond({
    locale,
    extensions: [
        // Add the MediaResolutionValidator extension
        [MediaResolutionValidator, {
            // Media must have a resolution of at least 1024 × 768 pixels
            minWidth: 1024,
            minHeight: 768
        }]
    ]
})

Configuration

The MediaResolutionValidator extension accepts an option object of type MediaResolutionValidatorOptions which defines the properties below.

minWidth

Min media width. Defaults to 1

minWidth?: number

maxWidth

Max media width. Defaults to Infinity

maxWidth?: number

minHeight

Min media height. Defaults to 1

minHeight?: number

maxHeight

Max media height. Defaults to Infinity

maxHeight?: number

minResolution

Min media resolution. Defaults to 1

minResolution?: number

maxResolution

Max media resolution. Defaults to Infinity

maxResolution?: number

toNaturalResolution

Function used to convert pixels (resolution) to natural resolution. Defaults to (pixels) => Math.round(pixels / 1000000)

toNaturalResolution?: (pixels: number) => string