So I have a few images which have different sizes and aspect ratios. I want to create a modal gallery of square thumbnails of those images in a grid form. When the user clicks on a thumbnail, the image should pop up on the screen with its original aspect ratio. Kind of like how twitter's desktop website displays your media thumbnails on your profile on the top right, next to your twitter banner. Now, I know how to do all of this except that I want each modal image to be contained(even cropped, and not overflowing) in a square thumbnail, and when the user clicks it, the actual image with its actual size/aspect ratio should pop up. I don't know how to create that square thumbnail modal window with the image not overflowing it.