Support

Account

Home Forums Feature Requests Image Field aspect ratio rule Reply To: Image Field aspect ratio rule

  • There are filters in ACF that would let you do this.

    You can add a custom setting using the acf/render_field_settings hook, see an example of this here https://github.com/Hube2/acf-filters-and-functions/blob/master/default-image-for-image-field.php.

    There are filters in the attachment validation that you can then you to validate the image. Take a look at /api/api-helpers.php line 3839. The filters are called on line 3984.

    
    // filter for 3rd party customization
    $errors = apply_filters("acf/validate_attachment", $errors, $file, $attachment, $field);
    $errors = apply_filters("acf/validate_attachment/type={$field['type']}", $errors, $file, $attachment, $field );
    $errors = apply_filters("acf/validate_attachment/name={$field['name']}", $errors, $file, $attachment, $field );
    $errors = apply_filters("acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field );