openscholar/openscholar — pull request #2373 by sagotsky (2013-04-09 19:40:46+00:00)
Title: Fixed media_gallery slideshow so it won't cut off tall images #2352

First I changed the image_style presets. They were scaling and cropping. That was wrong. Now they just scale.

Originally the image style was used to calculate an aspect ratio. That was applied to the max width to get the new dimensions which were swapped in by regex. Except that an item that was taller than wide could actually have its height _increased_ to fit the desired width. We needed a cap on the height.

I tried keeping the logic that was in place, but with an exception that tall images should base their size off the height rather than the width. The problem was there wasn't a good way to get the image height at this point, so I didn't know what a tall image was.

Instead I simplified things. The scaled images were already the right aspect ratio. Why was I recalculating that. Instead I got the preset's width against the desired width and multiplied by 100 to get a percentage. The view was setting the image's height and width each to 100%, so I swapped in the new percentage instead.