Popup Window Size - to Match Photo Dimensions

  • Thread starter Thread starter Kenny
  • Start date Start date
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.
 
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.
 
Back
Top