Popup Window Size - to Match Photo Dimensions

K

Kenny

The following link will take you to menu of photo galleries. If you open any
of the photo galleries you will see that each contains thumbnails. When a
thumbnail is clicked, the full-sized version of the photo is displayed in
its own popup window - AND the popup window size matches the photo size
(i.e., no white space).

What I'd like to know is to get the popup window size to match the photo
size.

http://www.amamotocross.com/gallery_archive.php?UID=LvFmihBrOMkKpXpqW8H90JvruXWHLs


Thanks.
 
T

Travis Murray

You need to dynamically construct your window.open() statement, passing it
height and width parameters. You can load the image into a bitmap to get
the height and width. Something like this (please excuse any syntax
errors...this is off the top of my head):

C#:
Bitmap b = new Bitmap("images/myfile.jpg");
Hyperlink1.NavigateURL = "javascript:window.open('images/myfile.jpg',
'height=" + b.Height + ",width=" + b.Width + "')";

VB:
Dim b As New Bitmap("images/myfile.jpg");
Hyperlink1.NavigateURL = "javascript:window.open('images/myfile.jpg',
'height=" + b.Height + ",width=" + b.Width + "')";

--
Travis Murray
MCSD, MCT
Artiem Consulting, Inc.
http://www.artiem.com
Learn ASP.Net In Jamaica in 2005!
Visit http://www.artiem.com/jamaica.aspx for more details.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top