How do I resize an image to fit a maximum height or width?
csImageFile has a command called ResizeFit which takes the maximum width and height as parameters and resizes the image to fit these dimensions while maintaining aspect ratio. It will not increase the image size if the image already fits inside the area specified. There is a downloadable example – Here.