Approx. 75 logos with different sizes and shapes.
Have a location defined by a DIV to constrain the image.
With any specific logo one of the following will work, but need to determine which one.
Not sure how to write the CSS to chose which scenario is best.
Maintaining the aspect ratio, I’m thinking something like this.
Collecting the image width and height.
Max-Height
Calculating what the resulting image width would be if the image height was set to max-height
Max-Width
Calculating what the resulting image height would be if the image width was set to max-width
Decision
If the resulting image width exceeds the threshold then use the Max-Width.
If the resulting image height exceeds the threshold then use the Max-Height.
If neither the resulting image width or height the exceed thresholds then use the one that produces the larger resulting image.
Alternatively set the image as background image for the div element and set the background-size property to “contain”. This scales the image as large as possible within its container without cropping or stretching the image.