resizeFit

Resize an image to fit within the given width and height. The re-sized image will not exceed the given dimension. Useful if you want to preserve the aspect ratio.

resizeFit ( ImageInterface &$image, int $newWidth, int $newHeight ): EditorInterface 
Parameters
image

Instance of Image.

newWidth

Width in pixels.

newHeight

Width in pixels.

Returns
An instance of Editor.