WP_REST_Attachments_Controller::dimension_exceeds_maxprivateWP 7.1.0

Checks whether a dimension exceeds the maximum allowed value.

A maximum of zero means the dimension is unconstrained.

Method of the class: WP_REST_Attachments_Controller{}

No Hooks.

Returns

bool. True if the value exceeds the maximum plus tolerance.

Usage

// private - for code of main (parent) class only
$result = $this->dimension_exceeds_max( $value, $max, $tolerance ): bool;
$value(int) (required)
The actual dimension in pixels.
$max(int) (required)
The maximum allowed dimension in pixels. Zero means no constraint.
$tolerance(int) (required)
Pixel tolerance allowed for rounding differences.

Changelog

Since 7.1.0 Introduced.

WP_REST_Attachments_Controller::dimension_exceeds_max() code WP 7.1

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