Jump to content

Window Size Based On Image Size


rquintal
 Share

Recommended Posts

I can use the window.open function to open a new window but I need to be able to open a new window with a size set by the size of an image that will be placed in that window. I have hundreds of these and I don't want to hard-code the script for each one with a specified window size. How do I get the height and width from the image and get the js to use those values?

Link to comment
Share on other sites

If the image is already on the page, you can get the width and height of it and use that to open the window. If it's not on a page, you could open a new window to something like a PHP script that would check the size of the image, output the HTML to show the image, and output some Javascript code to resize the window after it's already open.

Link to comment
Share on other sites

If the image is already on the page, you can get the width and height of it and use that to open the window. If it's not on a page, you could open a new window to something like a PHP script that would check the size of the image, output the HTML to show the image, and output some Javascript code to resize the window after it's already open.
They are not currently in pages. There are over four hundred of them and I don't want to spend the time making a page for each of them. Can js get the image size or must I use something like php?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...