Home › Forums › Front-end Issues › Image dimension validation not working correctly
Hi,
I have a front-end image upload form in my website which had worked fine, but is now experiencing problems.
In the form config, I have the minimum dimensions set to 900px. During upload any image less than 900px is prevented from being uploaded, but no error message is displayed and the success message is shown, leading users to believe their image has been uploaded when it hasn’t.
This only happens on the front end. Back end admin upload displays the error message.
I have tried switching to a default theme and deactivating all other plugins and get the same results.
I am using this code:
$new_post= array(
‘post_id’ => ‘user_’.$current_user->ID,
‘field_groups’ => array(8506),
‘form’ => true,
‘return’ => add_query_arg( ‘updated’, ‘true’, get_permalink() ),
‘html_before_fields’ => ”,
‘html_after_fields’ => ”,
‘submit_value’ => ‘Upload Logo’,
‘updated_messag’ => ‘Saved!’
);
acf_form( $new_post);
The file type validation works perfectly. It is just the dimensions that is a problem. Any ideas? Thanks.
I am having the same issue.
I’m using the validation code from here https://www.advancedcustomfields.com/resources/acf-validate_value/ to prevent uploading images < 960px but it blocks every photo even those > 960px
Same issue… when using this :
https://www.advancedcustomfields.com/resources/acf-validate_value/
$data variable =
string(36) “url=C%3A%5Cfakepath%5Cscreenshot.png”
and doesn”t works 🙁
Ok it seems not working in front office and acf_form with uplaoder=> ‘basic’
This is a know issue, or at least it has been brought up multiple times here, please contact the developer https://www.advancedcustomfields.com/contact/
The only way I kinda “solved” this was using jQuery to check the size of the image (and empty the value of the field if necessary).
A little dirty but it works.
Hope it helps somebody.
The topic ‘Image dimension validation not working correctly’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.