Home Forums Front-end Issues Image dimension validation not working correctly


Image dimension validation not working correctly

    • nuideas

    • January 5, 2019 at 9:51 pm

    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.

    • Troglos

    • January 12, 2020 at 12:05 am

    I am having the same issue.

    I’m using the validation code from here to prevent uploading images < 960px but it blocks every photo even those > 960px

  • Same issue… when using this :

    $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

    • Troglos

    • February 2, 2020 at 1:30 am

    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.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.