cherry-picking 5d0d784a3660: fixed horizontal image scaling
cherry-picking bc6428d441: Fixed else case in thumbnail generation
Merge pull request #27 from psu-stewardship/master

Cherry-picked commits to fix image scaling and thumbnailization