I have 2 images - that are proportional, but different sizes. One is 201px wide and 272px tall. The other is 442px wide and 596 px tall.
I have a small 80X90 box (div) placed on the small image (covering, for example someone's face). I would like to transform the same box onto the second image. In other words, the same person's face should be covered by the <div> on the larger image.
I know the coordinates of the box in the first (smaller image); and expect the box to get larger in the larger image. The algorithmn should be screen-resolution independent.
I don't know any Javascript. But I can tell you that the box on the larger image will measure 176 x 197 pixels. If your small box is located at (a,b) then the large box will be located at (a x 442 / 201 , b x 596 / 272).
You just need the ratio of the small side to the large side. The dimensions of the box can be obtained by filling into the above formula as well.
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.
what do you mean? I see a graphic... In fact two of them, and he is wondering how to put a graphical box on the images also...
Software languages known: Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known: Directx 7 and 8
Internet languages, in the process of learning: HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
I don't know any Javascript. But I can tell you that the box on the larger image will measure 176 x 197 pixels. If your small box is located at (a,b) then the large box will be located at (a x (442 / 201) , b x (596 / 272)).
You just need the ratio of the small side to the large side. The dimensions of the box can be obtained by filling into the above formula as well.
zaza
Dont forget parenthesis
Software languages known: Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known: Directx 7 and 8
Internet languages, in the process of learning: HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
it does matter 9 * 4 / 2 = 18 but ... 9 * (4 / 2) = 18... see the difference? duh!
Software languages known: Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
Software API's known: Directx 7 and 8
Internet languages, in the process of learning: HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX
what do you mean? I see a graphic... In fact two of them, and he is wondering how to put a graphical box on the images also...
This is more of a HTML question. As indicated by the word "<div>"
Without balance, there could only be chaos.
Without chaos, there could be no balance.
I live with karma. Eat with destiny. Dream of life without shackles....
Yet. If life had no consequences, life could not exist, nor could it flourish.
If at first you dont succeed.You're screwed.
C++/Java NOOB.
I aint a professional at PHP, but if i can help i will.