rquintal Posted July 20, 2009 Share Posted July 20, 2009 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 More sharing options...
justsomeguy Posted July 20, 2009 Share Posted July 20, 2009 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 More sharing options...
rquintal Posted July 20, 2009 Author Share Posted July 20, 2009 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 More sharing options...
justsomeguy Posted July 20, 2009 Share Posted July 20, 2009 Javascript can't get the size for an image that hasn't been loaded on the page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.