Made images over the fixed page size resize to the margined value

I was using this software last weekend, and had to include the below hack to make my images (sized at 1200xsomething) fit on the page.

It could probably come out much cleaner if one is more competent with ruby (I've never used it before!) but this was a simple hack to make larger images fit right.

Happy to adjust if required.