I am trying to create a simple web gallery to swap my images at
http://dev.lenosphotography.com
Go to the family section (should open a image bar at bottom - you may have
to scroll down - I have not finalized placement) - when you click on the
image thumbnail it calls a page (passing the reference to the "image name"
with this code. The swapfade code basicall swaps via fading one image for
another.. so I load the blank jpg with the size set to the real images W/H -
then call the swapfade function...
<script language="javascript1.2" type="text/javascript">
var iWidth = 0;
var iHeight = 0;
img1 = new Image();
img1.src = '<%=Request.QueryString( "photo" )%>';
iHeight=img1.height;
iWidth=img1.width;
document.write ("<img src='images/photoblank.jpg' border='1' id='photo'
width=", iWidth, " height=", iHeight, ">");
// alert(document.documentElement.innerHTML);
swapfade(document.getElementById('photo'),'<%=Requ est.QueryString(
"photo" )%>', '1', '');
</script>
_________________________________________________-
This works 99% of the time - but every so often the image comes up with
width and height = 0 - I am sure that it is due to the image not being fully
loaded before the img1.height line is called.. I have scoured the net on
this and found where I need to make sure the image is complete/loaded before
testing for it's height and width- nothing I have tried has worked yet...
Thanks for your help!