It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

How do I get a new window to open to the size of the image

How do I get a new window to open to the size of the image

Postby martinr on Sat Mar 10, 2007 1:06 am

Currently I have my images opening on a new window but the size of the window is not opening large enough to see the complete picture. The viewer has to manually go and re-size the window.
Is there a way of setting the window so that it opens to the size of the image?

Thanks
martinr
 
Posts: 2
Joined: Sat Mar 10, 2007 12:41 am

Postby mwa103 on Sat Mar 10, 2007 1:56 am

You'll have to use some form of scripting. This link shows you how to do it with Javascript: http://www.fontstuff.com/frontpage/fptut17.htm

You could also do it with server side scripting like php. If you want to know how to do it that way post back here and I can show you. It'll take a bit more work than doing it with Javascript.

-Mike

**Edit**
Sorry, that site just shows setting the window size for a known image size. Here is the one that shows you how to get the image's size. http://www.fontstuff.com/mailbag/qfrontpage01.htm
mwa103
100+ Club
 
Posts: 206
Joined: Mon Mar 07, 2005 10:55 pm

Postby sachav on Sat Mar 10, 2007 3:26 am

mwa103 -> Not at all!
All you have to do is a javascript function that opens the image...
Server-side scripting is server side, not browser side...

Anyway,
Try this:
Code: Select all
function openimg(url)
{
imgheight="YOUR IMAGE HEIGHT"
imgwidth="YOUR IMAGE WIDTH"
window.open(url,"img","height="+imgheight+", width="+imgwidth)
}


Replace your link by:
Code: Select all
javascript:openimg("URL OF YOUR PICTURE HERE")
sachav
 
Posts: 32
Joined: Sat Mar 03, 2007 3:40 pm

Postby mwa103 on Sat Mar 10, 2007 3:56 am

sachav,
Not at all? Did you follow the links? I provided links to Javascript functions which will do what he wants (open window that's same size as image without inputting the image size). I only mentioned the php if, for some reason, he didn't want to use the Javascript. Yes I know that server side scripting is server side, hence the name. However, it is possible to do the same thing with php as well. I was just providing all the options.
mwa103
100+ Club
 
Posts: 206
Joined: Mon Mar 07, 2005 10:55 pm

Postby martinr on Sat Mar 10, 2007 10:28 am

Mike,
Thanks for solving my problem, it works perfectly.

Martin
martinr
 
Posts: 2
Joined: Sat Mar 10, 2007 12:41 am


Who is online

Users browsing this forum: No registered users and 3 guests