Resizing Windows

K

K

I am trying to achieve the following - can anyone help?

Before you jump on me for wanting to interfere with the user's windows -
it's' for a corporate intranet where we can and will dictate what they see
and how they see it.

I have a popup which displays an image (not that it matters much I guess,
but entire site is in ASP).

I want the window to resize itself on opening to 'hug' the image. However,
some images will be bigger than the screen, so I want a maximum which it
will resize to if the image is bigger than the specified maximum.

Also, to confuse matters - some users have varying screen-resolutions, so an
added bonus would be to detect the users screen size and set the maximum
resize value according to this.

Any suggestions?

Thanks in advance
 
K

Karl Core

K said:
I am trying to achieve the following - can anyone help?

Before you jump on me for wanting to interfere with the user's windows -
it's' for a corporate intranet where we can and will dictate what they see
and how they see it.

I have a popup which displays an image (not that it matters much I guess,
but entire site is in ASP).

I want the window to resize itself on opening to 'hug' the image.
However,
some images will be bigger than the screen, so I want a maximum which it
will resize to if the image is bigger than the specified maximum.

Also, to confuse matters - some users have varying screen-resolutions, so
an
added bonus would be to detect the users screen size and set the maximum
resize value according to this.

I'm totally ignorant of ASP, but I imagine there's some sort of equivalent
of the PHP example I'm gonna use.

// Begin Code
$image="/path/to/image.gif";
$max_width = "xxx"; // this is the max width of the window
$max_height = "xxx"; //this is the max height of the window
$size = getimagesize("$image"); //get the actual size of the picture in an
array
$width = $size[0]; // get width of picture
$height = $size[1]; // get height of picture
if ($width>$max_width){
$pop_width=$max_width; // Resize if over max width
}else {
$pop_width=$width; // Keep original size from array because
smaller than max

}
if ($height>$max_height){
$pop_height=$max_height; // Resize if over max width
}else {
$pop_height=$height; // Keep original size from array
because smaller than max

}

//print the popup link
print("<a href=\"$image\" onclick=\"window.open('$image', 'popup_name_here',
'toolbar=no, location=no, status=no, menubar=no, scrollbars=no,
resizable=yes, width=$pop_width, height=$pop_height'); return false\">View
Full Size</a>");

// End Code

Due to browser differences, you may actually want to open the window to be
as many as 20 pixels wider than the image. Or, if you want an actual HTML
popup, you can do that too, and just pass the variables in the query string
 
K

K

Thank you

However, is this possible ith javascript or client-side vbscript? I am not
familiar with PHP at all.

I would like to open the window which will contain an ASP page with the
image on. It has to be this way as there is other ASP code running when the
image opens.

Thanks
 
K

Karl Core

K said:
Thank you

However, is this possible ith javascript or client-side vbscript? I am
not
familiar with PHP at all.

I would like to open the window which will contain an ASP page with the
image on. It has to be this way as there is other ASP code running when
the
image opens.

First, please quote when you reply on usenet. This will help others, who
stumble across this thread somewhere in the middle, understand that which
you and I are discussing.

I used PHP code only as an example. There *has* to be some sort of
equivalent capability within ASP.
I'm not sure if javascript or VBScript can do what I've shown. I don't know
those languages very well. Basically, what you have to do is detect the
size of the image and then dynamically resize the window to fit the image.

Just because you have other ASP code running, that doesn't mean you can't do
all this, too.
 
M

Mark Parnell

Previously in alt.html said:
I'm totally ignorant of ASP, but I imagine there's some sort of equivalent
of the PHP example I'm gonna use.

$size = getimagesize("$image"); //get the actual size of the picture in an
array

This is the only bit that I can see which doesn't have an ASP equivalent
- ASP doesn't have a built in function for getting the dimensions of an
image. There are a couple of add-on components that can do it though.

ASPImage
http://www.serverobjects.com/products.htm#aspimage

ImageSize
http://www.serverobjects.com/products.htm#free
 
K

K

Mark Parnell said:
This is the only bit that I can see which doesn't have an ASP equivalent
- ASP doesn't have a built in function for getting the dimensions of an
image. There are a couple of add-on components that can do it though.

ASPImage
http://www.serverobjects.com/products.htm#aspimage

ImageSize

Thanks

I don't have control over the web server to install custom components
however :-(

I need to achieve this entirely with client-side scripting - be it VB or
Javascript.

I will give PHP a try if all else fails, but I don't know it at all so I
really want to avoid it.
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top