I am doing a small website for a antique clocks dealer, and have a page where the image is shown and then text to the right which isn't a problem.

The client uploads a large image to the database because there a pop up option to see the image in full view, and then this is where I need to find out the size of the image for the thumbnail pic.

Some of the image are of long clocks so thats fine as I can just set the height to say 650px and leave it at that, and then its its nicely on the page as the width doesnt get to big in relation.

But some of the clocks are short but wide, so what I wanted to do was have a script where if the height of the image was more than 650px, it didnt allow it to go over that, but if the image is say wider than 300px, then it stopped it there and the height adjusted accordingly.

Does that make sense?