Hi!
I need someone who is very good with maths to help me
with this, unfortunatly I suck at maths so that
someone can not be me. Ironically before I started my
first computer course years back I asked the
instructer if "learning computers needed a lot of
maths...she said 'no, just basics'"..that aint really
true is it? :-D
Anyway, I have 2 scripts, one that resizes an image
according to the height and width i specify and
another that cuts a w=90 h=120 thumb from *within* an
image according to the x and y parameters I send it.
This functionality is distributed in 2 scripts.
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.
eg:
if i have an image of (height and width) 800x600 what
would the dimensions be if the height was 120?
usually for resizeing I just do something like this:
if($image_height > 400)
{$image_height=$image_height / 2;
$image_width=$image_width / 2;}
which gets me a pretty decent image....but now I need
an image no more than 120px in height with a
proportionate width.
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*
eg: if from problem 1 the result is an image of 120 x
160 then x=35 and y=125 (I think, i told you i suck at
maths.. :-D )
Anyone up to the challenge? or just want to help a
poor person with some maths?
Thanks in advance,
Mag
=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php