PDA

View Full Version : can you help with image magnify



evan5
08-03-2009, 06:13 PM
http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm

Hey guys, I am trying to figure out something with this script. In it's JS file, it let you set how many times you want it magnified by, let say 2x or 3x the original image. But how would I be able to set it to magnify to its natural image size, because it ends up being blurry when you magnify it by x2 or x3....:confused:

ddadmin
08-03-2009, 09:42 PM
The script does not know the actual, true dimensions of the image it's magnifying unfortunately. So in order to magnify to those dimensions, you'll need to some some quick math to figure it out. Lets say you have an image that's naively 300 x 450px, though initially, you want to display it as a thumbnail with width 50px. With a little Math you know the height should then be 75px:


<img src="test.gif" style="width:50px; height:75px" />

Then, to magnify this thumbnail back to its native dimensions, you know the magnification should be 6x.