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

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

A maximum of zero means the dimension is unconstrained.

Parameters

$valueintrequired
The actual dimension in pixels.
$maxintrequired
The maximum allowed dimension in pixels. Zero means no constraint.
$toleranceintrequired
Pixel tolerance allowed for rounding differences.

Return

bool True if the value exceeds the maximum plus tolerance.

Source

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

Changelog

VersionDescription
7.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.