I know that I can use the add_image_size()
function in the function.php
of the theme to pre-determine the additional desired image file of specific width & height to be cropped and uploaded.
However, what I want to achieve is by giving a fixed aspect ratio (say 7:5 or 5:7, depending on whether the image is of the landscape/portrait type) and after the user click the form submit button to upload the file, the page will dynamically determine the desired width and height with the correct aspect ratio, and crop the original file then upload it.
For example, if the original file width and height is 72 x 50 (or 500 x 720), the page will dynamically crop the file to 70 x 50 (or 500 x 700), and upload this additional file along with other 3 files of default sizes.
Any help would be greatly appreciated.