Make lightbox script not resize images larger than itself.

The issue for [#53567745] was that the script which expanded the size of the image would first check if the width was smaller than the max, and scale up the image, then *also* check if the height was smaller than the max, and scale up *again*, resulting in an image which was too big. The significant change here is to check to see if the image is horizontal (width greater than height) or vertical (height greater than width) and only resize *once* based on the width or height respectively. This produces reasonably sized images.

https://www.pivotaltracker.com/story/show/53567745