Clanbite Since 1.6.3

crop_square( int $width, int $height, float $x, float $y, float $zoom ): array{left: int, top: int, side: int}

The square, in source pixels, that is shown for a focal point and zoom.

Follows how the browser draws it: the image fills a square (object-fit: cover) at object-position x% y%, then it is scaled by the zoom around the same point. The editor preview uses the same formula, so what the player sees is what is saved.

public static

Class: Kernowdev\Clanbite\Extensions\Players\Player_Media

Parameters

$width (int) Required

Source width in pixels.

$height (int) Required

Source height in pixels.

$x (float) Required

Focal point, 0 to 1.

$y (float) Required

Focal point, 0 to 1.

$zoom (float) Required

Zoom, 1 to MAX_ZOOM.

Returns

array{left: int, top: int, side: int}

Defined in inc/extensions/players/class-player-media.php

Changelog

VersionDescription
1.6.3Introduced.