Preventing blank space at bottom of page

I have a site that uses a css-based image preview tool so that when you hover over an image the full-size image is displayed on the page. However I have one problem with this. This is that sometimes the image is too big for the page and so creates some white space at the bottom of the page. Is there anyway to set a definite size for the page so that instead of the image making the page longer, the page would just stop and possible the image would be cut slightly?

In css you could specify a width/height and set overflow to hidden.
OR
Use the gd lib and with get_image_size, if the image is too large, resize it so it will fit.
OR
Resize the images (if too large) when they are uploaded.

To fix page height you can specify height to a particular value. But I think this is not good idea. To resize image use image style as,

<img src="...." style="width:40px; height:40px; border:none;" />

Alternatively you can define img style for that division in your style sheet.