Get or set focus area for crops to use
These settings are used by $this->size() calls that specify BOTH width AND height. Focus helps to ensure that the important subject of the photo is not cropped out when the requested size proportion differs from the original image proportion. For example, not chopping off someone’s head in a photo.
Default behavior is to return an array containing "top" and "left" indexes, representing percentages from top and left. When arguments are specified, you are either setting the top/left percentages, or unsetting focus, or getting focus in different ways, described in arguments below.
A zoom argument/property is also present here for future use, but not currently supported.
Usage
// basic usage
$array = $pageimage->focus();
// usage with all arguments
$array = $pageimage->focus($top = null, $left = null, $zoom = null);
Arguments
Name | Type(s) | Description |
---|---|---|
top (optional) | null, float, int, array, false | Omit to get focus array, or specify one of the following:
|
left (optional) | null, float, int | Set left value (when $top value is float|int)
|
zoom (optional) | null, int | Zoom percent (not currently supported) |
Return value
array
bool
Pageimage
Returns one of the following:
- When getting returns array containing top, left and default properties.
- When TRUE was specified for the $top argument, it returns either TRUE (has focus) or FALSE (does not have).
- When setting or unsetting returns $this.
Pageimage methods and properties
API reference based on ProcessWire core version 3.0.236