Smart resize preserving aspect ratio

When this checkbox is checked the image provided is cropped and resized to the desired width and height. It wil preserve the aspect ratio so no deformation will occur.

Example

Start image:

Result without preserving aspect ratio checked, image is resized to fit, deformation may occur:

Result with preserving aspect ratio checked, image is first cropped then resized, no deformation but loss of both sides of image: