i recently had this problem and used a class downloaded from web.. i dont remember from where, but i had fixed some bugs... and does not understood all the functions
any way, i ziped it and put at
www.indexzero.com.br/imagesize.zip
download it and take a look.. for me it worked fine (at www.vialettera.com.br - every book image sizes are taken with that class).
it does not use any library (like gd library... that stuff never work when you need and doesn't suports gif) and (this class) suports gif, jpg, tif, bmp (mybe more, i dont remember)..
bye