|
Home > Archive > IIS ASP > May 2005 > Popup - detect and autosize to image
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
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
| |
| McKirahan 2005-05-25, 8:52 pm |
| "Jake" <spamthis@alltel.net> wrote in message
news:OsQw9uWYFHA.3572@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="java script: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>
| |
| Mark Schupp 2005-05-26, 6:00 pm |
| 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" <spamthis@alltel.net> wrote in message
news:OsQw9uWYFHA.3572@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
>
>
|
|
|
|
|