I have an image that is:
320 original width 407 original height
I want to let users resize the image via a form I am building on a webpage. They can adjust either the width or height. When they do the other dimension should auto adjust to maintain the aspect ratio.
When a user updates the width field I get the adjusted height like so:
aspect ratio = original width ÷ original height adjusted height = <user chosen width> ÷ aspect ratio
Is this correct?
Also how to get the adjusted width when the user changes the height field? I know it should be simple enough but I just can't figure it out.