Title: WP_REST_Attachments_Controller::dimension_exceeds_max
Published: August 20, 2026

---

# WP_REST_Attachments_Controller::dimension_exceeds_max( int $value, int $max, int $tolerance ): bool

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#wp--skip-link--target)

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Checks whether a dimension exceeds the maximum allowed value.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#description)󠁿

A maximum of zero means the dimension is unconstrained.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#parameters)󠁿

 `$value`intrequired

The actual dimension in pixels.

`$max`intrequired

The maximum allowed dimension in pixels. Zero means no constraint.

`$tolerance`intrequired

Pixel tolerance allowed for rounding differences.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#return)󠁿

 bool True if the value exceeds the maximum plus tolerance.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#source)󠁿

    ```php
    private function dimension_exceeds_max( int $value, int $max, int $tolerance ): bool {
    	return $max > 0 && $value > $max + $tolerance;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L2740)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php#L2740-L2742)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_REST_Attachments_Controller::validate_image_dimensions()](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/validate_image_dimensions/)`wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php` |

Validates that uploaded image dimensions are appropriate for the specified image size.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_rest_attachments_controller/dimension_exceeds_max/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.1.0](https://developer.wordpress.org/reference/since/7.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_rest_attachments_controller%2Fdimension_exceeds_max%2F)
before being able to contribute a note or feedback.