I have standards for image size as width: 640px, height 360px to resize an image. And I want to preserve the ratio of an image.
In the case of original image size is larger than the standard, it has to be shrink to width 640px or height 360px, otherwise, it has to be stretched.
I think css should be something like this:
img {
max-width: min({{original image width}}, 640px)
max-height: min({{original image height}}, 360px)
min-width: max({{original image width}}, 640px)
min-height: max({{original image height}}, 360px)
}
Is there any ways to fit this condition?