ImageScaler
ImageScaler

This class provides very simple server-side iage scaling.  This requires the GD extension.

Functions
getScalingOptions
public function getScalingOptions(): array

Gets the available size ranges, keyed by the size mode.

Returns

An array of size modes to target width/height.

scaleImage
public function scaleImage(
string $source,
string $mode
): string

Scales an image down to the desired size.  Note that portrait/landscape detection is automatic - if the images is taller than it is wide, the target height/width will be flipped.

Parameters
source
string$

String contiaining the source file path

mode
string$

String with the name of the scaling mode ot use

Returns

The path to the scaled image.  Throws on failure.