Forum Moderators: open

Message Too Old, No Replies

Reading an images dimensions

         

jfred1979

2:21 pm on Jan 13, 2004 (gmt 0)

10+ Year Member



Is it possible to read an images horizontal and vertical dimensions before it's actually written to a document? I'd like to create an image browsing script that opens a fitted popup window based on the size of the image, without having to specify the height and width for each image.

BlobFisk

2:28 pm on Jan 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think that you can do this with JavaScript. As JavaScript is a client side language, the image would need to be part of the document object model (DOM) before you could use JavaScript to do anything with it.

jfred1979

3:06 pm on Jan 13, 2004 (gmt 0)

10+ Year Member



I don't think that you can do this with JavaScript. As JavaScript is a client side language, the image would need to be part of the document object model (DOM) before you could use JavaScript to do anything with it.

I have put the image path into a string, is there anyway to add it to the DOM without actually rendering it?

BlobFisk

3:18 pm on Jan 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can you put the image dimensions into a string also? Or do you want to be able to dynamically calculate these?

jfred1979

5:47 pm on Jan 13, 2004 (gmt 0)

10+ Year Member



Can you put the image dimensions into a string also? Or do you want to be able to dynamically calculate these?

I have the dimensions in a string right now, I'd like to make it so it will calculate them.