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) RequiredSource width in pixels.
$height(int) RequiredSource height in pixels.
$x(float) RequiredFocal point, 0 to 1.
$y(float) RequiredFocal point, 0 to 1.
$zoom(float) RequiredZoom, 1 to MAX_ZOOM.
Returns
array{left: int, top: int, side: int}
Defined in inc/extensions/players/class-player-media.php
Changelog
| Version | Description |
|---|---|
| 1.6.3 | Introduced. |