dealmaker
08-16-2005, 01:43 AM
Hi,
I am loading images from server. The webpage loads pages of images, but I need to shrink them into thumbnails. I don't plan to make real thumbnail pictures for these images, I just load them fullsize but show them in smaller size. I can't set a fix size in html tag because all images are in different sizes and I use the same code for all pages.
I can do the following:
imgElement = document.createElement("IMG");
imgElement.src = "mypic.jpg"
imgElement.style.width = 90 + 'px';
imgElement.style.height = 100 + 'px';
But I want the thumbnail has the same aspect ratio as the original one. But since the image isn't loaded yet, I can't find out the dimension of the original image.
How can I go around this problem?
Many thanks.
I am loading images from server. The webpage loads pages of images, but I need to shrink them into thumbnails. I don't plan to make real thumbnail pictures for these images, I just load them fullsize but show them in smaller size. I can't set a fix size in html tag because all images are in different sizes and I use the same code for all pages.
I can do the following:
imgElement = document.createElement("IMG");
imgElement.src = "mypic.jpg"
imgElement.style.width = 90 + 'px';
imgElement.style.height = 100 + 'px';
But I want the thumbnail has the same aspect ratio as the original one. But since the image isn't loaded yet, I can't find out the dimension of the original image.
How can I go around this problem?
Many thanks.