gpfup_meets_minimum_requirement (JS)
Description
Filter whether or not image meets minimum size requirement.
Usage
gform.addFilter( 'gpfup_meets_minimum_requirement', my_custom_function );
Parameters
meetsMinimum boolean
Whether or not image meets minimun size requirement.
imageSize Object
The current image size object
formId int
The current form ID
fieldId int
The current uploader field ID
gpfupInstance GPFUPField
Current File Upload Pro class instance
Examples
Honor either minimum requirement instead of requiring both
If uploaded image width or height is greater than the minimum width setting, then image meets minimum size requirement.
/**
* Gravity Perks // File Upload Pro // Enforce Minimum Width or Height
* https://gravitywiz.com/path/to/article/
*
* By default, the minimum width *and* height will be enforced. With this snippet you set a minimum width and enforce that for the width *or* height.
* For example, if you specify a minimum width of 1200px, this snippet would accept an image that is either 1200px wide or 1200px tall.
*
* Instructions:
*
* 1. Install this snippet with our free Code Chest plugin.
* https://gravitywiz.com/gravity-forms-code-chest/
*/
window.gform.addFilter( 'gpfup_meets_minimum_requirement', function ( meetsMinimum, imageSize, formId, fieldId, GPFUP ) {
if ( imageSize.width > GPFUP.minWidth || imageSize.height > GPFUP.minWidth ) {
return true;
}
return meetsMinimum;
} );
Since
This filter is available since Gravity Forms File Upload Pro 1.3.17