Guys,
I'm going to be honest, I've had a little to drink and I cannot put this together.
I have a said original image of 604x402 pixels.
I use the following to find the new dimensions of a large thumb, while trying to maintain the ratio;
$new_w = 480;
$new_h = 360;
//...
if ($old_x > $old_y) {
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y) {
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y) {
$thumb_w=$new_w;
$thumb_h=$new_h;
}
//...
and get an improper distorted image of 480x239 pixels...
it should be right around 480 by 320 pixels to maintain the ratio,
what's wrong with my algorithm?