View Full Version : How to show gif dimensions and recalculate a resize ?

04-15-2010, 11:00 AM
How do I start creating this :

1. show dimensions in cm or mm of the dynamic gif-image : "width mm" x "heigth mm"
2. fill in a new width or height
3. hit "calculate" button
4. result : resized dimensions (constrain proportions)


Purpose : customer can find out the dimensions he wants

All my images have a standard dimension, the largest side is always 300px. That can be the width or that can be the height.
So let's say 300 px = 50 mm and the customer wants the image 250 mm wide, than that px-size has to be multiplied by 5 for width and height.
The script must detect the 300px and read the size (250 mm) that you put in a field, and give back the recalculated sizes in mm for both.

So far ... so good ... but now I'am finished, I can't write these code ! :blush:

TestPage (http://www.frogstyling.be/X_Tests/Test_wihe_JS2.asp)

The px has to be transformed to mm, e.g.: 1px = 0,25 mm.
Then if you fill in a new width/height, it can be recalculated.