Hi
I’d like to validate a basic image field before form submit in frontend.
How can I get image width, height and weight ?
add_filter('acf/validate_value/name=my_image_field', 'my_field_validation', 10, 4);
function my_field_validation($valid, $value, $field, $input){
// get image width
// get image height
// get image weight
}
I can’t use wp_get_attachment_image_src
as image is not uploaded yet.
Any help would be appreciated
You would need to add custom JavaScript to the basic uploader. I don’t know to modify the uploader but I did find some information on how to validate images before upload here https://stackoverflow.com/questions/8903854/check-image-width-and-height-before-upload-with-javascript