Hi,
CSS and Javascript can be used.
We want to upload an image in a container with fixed dimensions (height and width).
There are many conditions:
1) if the image is larger than the container, then it should ask the user to crop the image according to the dimensions of the container.
2) if the image is of same dimensions - then will upload properly.
3) if the height is more, and width less - then the image will be uploaded vertically center aligned.
4) If the height is less and width more - then the image will be uploaded horizontal center aligned.
5) If the height and image is less - then the image should be center aligned.