Hello everyone. I have a nice little slideshow script. The problem with this is, not every image used is the same size. Some are the nice squares(or actually just like moniters, slightly rectangles), and there are some that are long rectangles, some that are just small(don't want to stretch them).
Rather than just leave everything at the default size, I need them resized since some images are very large and would not fit in the 'box' for my slideshow. Others are small and get stretched.
So is there some way to check an image size. If it is greater than a size(the demensions of my box), I resize it down to the size of my box(which is what I do with all images now), but if it is smaller, I can simply leave the image size alone and let it use the defaults for that image.
It would be great if there were some way to do this. I can't go in and resize every image I am using since this is for a client.
"Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"
For any given IMG element there are 2 properties that tell you the original size of the image specified by the src property: naturalWidth and naturalHeight.
If your container stretches when the window is resized then you can find out how big it is with the offsetWidth and offsetHeight properties.