Thank you for sharing the access details.
I've performed some testing and research with a similar form on my website and here are the findings:
The filter 'cred_form_ajax_upload_validate' (that the code from the referenced ticket is using), specifically targets the event when a new image is uploaded into the WordPress media library through Toolset Forms.
For this filter to trigger, the following conditions need to be met:
1. In the form's settings, the 'Use the WordPress Media Library manager for image, video, audio, or file fields' option needs to be checked.
AND
2. The new image should be uploaded as it won't fire if an existing image from the media library is selected.
AND
3. The visitor who is submitting the form, needs to be logged in as a user. For guests (non-logged-in), this filter won't be triggered because the guests can't upload images into the media library and a standard image upload field is shown when they are submitting the form.
So, if you need to target the featured image field in a more generic way, you can switch to the 'cred_form_validate' hook, instead:
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate )
Example:
add_filter('cred_form_validate','my_validation',10,2);
function my_validation($error_fields, $form_data)
{
//field data are field values and errors
list($fields,$errors)=$error_fields;
//validate if specific form
if ( ($form_data['id']==356) ) {
if(!empty($fields['_featured_image']['file_data'])) {
list($width, $height, $type, $attr) = getimagesize($fields['_featured_image']['file_data']['tmp_name']);
if ($width != 500 && $height != 500) {
//set error message for featured image
$errors['_featured_image'] = 'Image size must be 500 * 500, your image dimensions are '.$width.' * '.$height;
}
}
}
//return result
return array($fields,$errors);
}
This should do the trick.