473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Popup - detect and autosize to image

Hi,
I have a page with a bunch of thumbnails that when clicked, open the full
size image in a new window. They are all different sizes and its a bit
unprofessional looking. I'd like to find a component or script that will
detect the size of the linked image and create a popup correctly sized to
the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
correctly sized window.

Any way to do this?

TIA
Jul 22 '05 #1
2 5471
"Jake" <sp******@alltel.net> wrote in message
news:Os**************@TK2MSFTNGP12.phx.gbl...
Hi,
I have a page with a bunch of thumbnails that when clicked, open the full
size image in a new window. They are all different sizes and its a bit
unprofessional looking. I'd like to find a component or script that will
detect the size of the linked image and create a popup correctly sized to
the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
correctly sized window.

Any way to do this?

TIA

Will this help? Watch for word-wrap.

<html>
<head>
<title>enlarge.htm</title>
<script type="text/javascript">
function enlarge(image) {
var i = new Image();
i.src = image;
var x = i.width;
var y = i.height;
// window.status for degugging:
window.status = image + " = " + x + " x " + y + " pixels";
var z = "scrollbars=no,width=" + (x+20) + ",height=" + (y+20);
window.open(image,"image",z);
}
</script>
</head>
<body>
<a
href="javascript:enlarge('http://www.google.com/intl/en/images/logo.gif');"<img src="http://groups-beta.google.com/images/google_sm.gif"

border="1" width="143" height="59" alt="Click to enlarge"></a>
</body>
</html>
Jul 22 '05 #2
first you will need to get the actual size of the image. best time to do
this is when you upload the image (keep info in a database so that you don't
have to extract it every time a page is displayed). If you know the size at
that time use it. otherwise see http://www.aspfaq.com/show.asp?id=2170 for
info about extracting size.

Embed the size in your window.open statement (in the client-side code you
generate) for each thumbnail link.

--
Mark Schupp

"Jake" <sp******@alltel.net> wrote in message
news:Os**************@TK2MSFTNGP12.phx.gbl...
Hi,
I have a page with a bunch of thumbnails that when clicked, open the full
size image in a new window. They are all different sizes and its a bit
unprofessional looking. I'd like to find a component or script that will
detect the size of the linked image and create a popup correctly sized to
the image. Would have no toolbar, buttons,scrolling, etc. Just a clean,
correctly sized window.

Any way to do this?

TIA

Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Moon | last post by:
Seems I still haven't got the hang of all those window generating code in Javascript. I've got a page with about 15 photo thumbnails. When you click on a thumbnail a new window pops up which shows...
10
by: Agony.COM | last post by:
Hi there all, Is there a way, using Javascript, that you can detect if a popup window has opened successfully? I'm tring to work out if someone is running popup blocking software or not. ...
13
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related...
6
by: Rich | last post by:
Hello, I am putting together a simple picture viewing program to view jpg. bmp pictures. I have the picturebox sizemode set to autosize. I have the picturebox in a pannel set to autoscroll, so...
1
by: Al | last post by:
I'm using visual C# 2005 Express Edition and I would like to open the image in the picture box, without make the picture box larger. For the moment, the code is: private void button1_Click(object...
8
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False...
2
by: Dravid | last post by:
Hello, I am putting together a simple picture viewing program to view jpg pictures. I have the picturebox autosize set to true. I dont have the picturebox in a pannel set to autoscroll, so if I...
1
mageswar005
by: mageswar005 | last post by:
hi, how to detect yahoo popup blocker, in my site i open a popup window but some local pc yahoo popup blocker can control my popup window. how can i detect the popup blocker....
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the popup window. The app is a form based...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.