Problem 1)
$h_1 = 600; $w_1 = 800;
$h_2 = 120; $w_2 = $w_1 * ($h_2 / $h_1);
Problem 2 a)
Assuming you're wanting the central portion of the original image (which I think you are from what you've written)
$h_1 = 600; $w_1 = 800;
$h_2 = 120; $w_2 = 90;
$x = ($h_1 - $h_2) / 2; $y = ($w_1 - $w_2) / 2;
Problem 2 b)
If you're in fact trying to get the central portion of the new thumbnail
$h_1 = 600; $w_1 = 800;
$h_2 = 120;
$w_2 = $w_1 * ($h_2 / $h_1); // need to have the correct thumbnail width to start from
$x = ($w_2 - 90) / 2; $y = 0; // because the image is only 120px high
Hope this helps
Cheers
Chris
Mag wrote:<><>
> [snip] > Heres my maths problems in 2 parts: > > Problem 1) > I need to scale down an image (eg: example.jpg) to > height of 120 pixels while maintaining the images > proportions. > [/snip] > ... > [snip] > Problem 2) > After getting the above image now I need the x and y > parameters to cut a h120 x w90 thumb *from the center > of the image* > [/snip]
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

