This seems like something that would've been asked before but I can't find the duplicate so...
I want the smallest dimension of an image to be scaled max 200 while keeping aspect ratio. So:
- A 600x400 image has smallest dimension 400, which should be 200 so scale by 0.5: new image will be 300x200
- Similarly 400x800 will be 200x400
- The smallest dimension for 100x300 is already < 200 so it will remain 100x300.
Obviously if it can be done with css then that is preferred over javascript.