Welcome to WebmasterWorld Guest from

Forum Moderators: ocean10000

Message Too Old, No Replies

Image width and height

Can't get anything to work!

6:06 pm on Mar 17, 2006 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 3, 2004
votes: 0

Hello. What I am trying to do is as follows:

1) Upload an image to server via ASP and store URL in a SQL database. This I have accoplished.

2) Before or after upload, get image width and height to enter into the database so that I can dynamically change the size of my pop-up image window.

I can't seem to find an effective SIMPLE way to get file information in ASP. THis is really starting to get my goat!

Any input is greatly appreciated!

-- Zak

6:13 pm on Mar 17, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Sept 1, 2001
votes: 0

Some of the upload components in ASP have properties available for retrieving the size data. One component also has the ability to resize the image during the upload. I find that one really handy.

As for displaying it actual size, you don't need to specify the width and height in the link. the image will display at actual size.

4:40 pm on Mar 19, 2006 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 13, 2005
votes: 0

I think he want's the pop up window to resize to the picture size. This is how I do it in ASP:

<script language='javascript'>
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
picUrl = picUrl + '?' + arrTemp[2];
//alert(picUrl + '?' + arrTemp[2]);
var NS = (navigator.appName=="Netscape")?true:false;

function FitPic() {
iWidth = (NS)?window.innerWidth:document.body.clientWidth;
iHeight = (NS)?window.innerHeight:document.body.clientHeight;
iWidth = document.images[0].width - iWidth;
iHeight = document.images[0].height - iHeight;
window.resizeBy(iWidth, iHeight);
<body bgcolor="#000000" onload='FitPic();' topmargin="0"
marginheight="0" leftmargin="0" marginwidth="0">
<script language='javascript'>
document.write( "<img src='" + picUrl + "' border=0>" );

You just have to pass the URL of the photo into this page and it will resize the page dynamically:

<script language="Javascript">
function PopupPic(sPicURL) {
window.open( "/popup.asp?"+sPicURL, "", "resizable=1,HEIGHT=200,WIDTH=200");

This is the function to initially open the window to 200x200(this can be whatever).