In my experiment, I uploaded .png files, and set up their size with pixel.
But, some pictures(I think in case the original height is longer than the height I set) are distorted.
How can I modify my script without any picture distortion?
(maybe using %..?)
The images will be shown at the size you specify in the .size comment. If your original is, say, 1500*850px (a ratio of ~1.8)and you force a size of 450*450px (ratio of 1) then you should expect the image to be displayed distorted. What you can do is .css({"max-width": "450px", "max-height": "450px"}) — if your original image doesn’t have a ratio of 1, its displayed size won’t be 450*450px, but it will be resized so that its longer dimension will be 450px