OK, I am uploading an image and would like to created a thumbnail. I need to calculate it's size before I send it to the class for resizing.
I have two values
$thumb_height = 100;
$thumb_width = 50;
That's the final result I need.
I also have the values of the original images before it's resized:
$original_height = $valH;
$original_width = $valH;
Here's what needs to happen:
- I determin which side is bigger (let's say it height)
if ($original_height > $original_width) {
// then need to resize the smaller size to my thumb's size
// so I do that and get
$new_width = $thumb_width;
}
Now I need to:
1. Calculate the height of the resized image -- it's scaled proportionally.
2. Subtract from it the desired height
2. Split the value in two and
3. Crop from both sides of the image
I can do everything all the way until resizing the thumbnail and need help to calculating the new height after I scale the image.
Writer's block.