pr0gram the pr0grammer wrote:

It's not too hard to calculate your thumbnail size from your original image size. Let's say your original is AxB, and you want the thumbnail to be at the maximum 160x160. The aspect ratio of the original image is A/B. Therefore, if your thumbnail is XxY, then X/Y = A/B. If X = 160, then Y = A/(B*160). If Y is <160> 160, then let Y = 160, and calculate X by going X = 160*A/B, and this will be your thumbnail size. When you go to create the new thumbnail image in GD, set your width & height to these calculated X and Y values.

I think my brain just went into spasm...