myFunction(400, 300, 50, 100) => Must return the width and heigth to resize my 400x300 (1st and 2nd params) image proportionally. The resized image must be at minimum 50x100 (3rd and 4th params). It's totally ok to go 52x.. or ..x102 but the "oversize" must be as small as matematically possible to keep the aspect ratio.
[new_image_width, new_image_height] function(image_width, image_height, reference_width, reference_height)
This function takes:
image_width: the width of an image
image_height: the height of an image
reference_width: the desidered minimum width of the image (see below)
reference_height: the desidered minimum height of the image (see below)
new_image_width: the proportionally resized width of the image (see below)
new_image_height: the proportionally resized height of the image (see below)
The function must calculate the closest width and height to respective "reference" parameter, without going below, and preserving the aspect ratio.
My function must not actually resize the image, only return the new integer to resize to.
Note: I'm confortable with code but 1st-grade-level with math. Please show some mercy :-(