I am building a photo gallery using code which creates thumbnails of a specific size from any image. When clicked the thumbnail expands dynamically to a pre-determined size.
The sizes of the thumbnails and the enlarged image are set via variables. To work properly, all the original images must be the same dimensions which means a great deal of editing and cropping before the images can be posted. And portrait images sometimes cannot be cropped to fit.
My code starts by creating thumbnails from the original image and as such doesn't need to know the orginal dimensions because I don't much care if the thumbnail distorts.
But I need to be able to obtain the original image dimensions so that I can apply a test when enlarging and use different final dimensions depending on the originals.
To keep it simple I only need to check whether the original is portrait or landscape.
All my images are either 600 x 450 landscape or 450 x 600 portrait. So I only need to check one dimension, say the width.
But how can I get that dimension?
I have a feeling getElementById may have the answer but I'm not yet comfortable with the COM model.
Can anybody suggest a snippet that might do the job?
John
The sizes of the thumbnails and the enlarged image are set via variables. To work properly, all the original images must be the same dimensions which means a great deal of editing and cropping before the images can be posted. And portrait images sometimes cannot be cropped to fit.
My code starts by creating thumbnails from the original image and as such doesn't need to know the orginal dimensions because I don't much care if the thumbnail distorts.
But I need to be able to obtain the original image dimensions so that I can apply a test when enlarging and use different final dimensions depending on the originals.
To keep it simple I only need to check whether the original is portrait or landscape.
All my images are either 600 x 450 landscape or 450 x 600 portrait. So I only need to check one dimension, say the width.
But how can I get that dimension?
I have a feeling getElementById may have the answer but I'm not yet comfortable with the COM model.
Can anybody suggest a snippet that might do the job?
John
Comment