Forums

This topic is locked

Popup resized dinamically according to images

Posted 16 May 2002 19:03:32
1
has voted
16 May 2002 19:03:32 Ivan Halen posted:
Ok, I have a page that displays dinamically some thumbnails of pictures that have different sizes... thumbnails are all of the same dimension, but full-size pictures are not: some were taken from my webcam at 320*240, some from my digital camera at 640*480 or more, some from scanner and have a variable size... of course, the list of pictures with their thumbnails is taken from a database - I used Horizontal Looper to do this -. When I click on the single thumbnails, a detail page is opened showing the full-size image in a popup window (I used the Open Browser Window javaScript that comes in the Behavior palette and slightly modified the script)
Now comes the question: is there a way to set the size of this popup window dinamically, according to the width and height of the full-size image opened? It's nice to have a 640*480 image opened in a 640*480 popup window, but it's not so good to have a 320*240 image opened in the same 640*480 window! I could insert the width and the height of the single images in specific fields of my database and recall them to resize dinamically the popup, but this would be an annoying job! What I'd like is to don't specify any width and height, and let ASP do this job for me... can someone help? Thank you

Replies

Replied 17 May 2002 02:59:47
17 May 2002 02:59:47 David Behan replied:
If you uploaded your large images using pureASP upload you could store the dimensions in the database along side the large image details. Or you could manually input them into the database in relation to each small picture. Using the advanced pop up menu (I think from the lads here at udzone) you can hand code the value into the pop script.

I'll have a look at it tomorrow and confirm if that would work ok and explain exactly how to do it... just too tired now (its 2am)! Try and see anyway.

Regards,


Dave

_________________________
David Behan - www.site-manager.com/af.asp?a=11&l=1tds9p6x2
Replied 17 May 2002 12:01:52
17 May 2002 12:01:52 Ivan Halen replied:
uhm... I don't use pureASP Upload... I find more convenient to store my files via FTP, and I don't want to manually input dimensions of my images into database... what I'd like is an automatic resize of the popup window... I saw that when my full-sized images are loaded in the detail page, their dimension is the right one, without specifying width and height, and I'd like to know if I can do the same with the dimension of the popup window (the detail page) that will contain each image
ehm... what are the lads? being an italian I don't understand all the words... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks again

Replied 17 May 2002 12:10:59
17 May 2002 12:10:59 David Behan replied:
lads is the people here at udzone.

If you're using IE6 it auto rezizes the image to fit into the current window. Not in other browsers I don't think. I don't know how to do what you want without putting the values into the database. Off hand that is what I'd do... put them in the dbase and specify those dimensions in the pop up window function.


Regards

_________________________
David Behan - www.site-manager.com/af.asp?a=11&l=1tds9p6x2
Replied 17 May 2002 15:01:12
17 May 2002 15:01:12 Ivan Halen replied:
Thanks again, Beano... I use IE 5.5, and i'd like my picture gallery compatible with most browsers... i heard that UDZone will release Advanced Open Window 3 in July, it seems to have the feature I'm searching
'til there, i'll put dimensions in my database <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Thanks again

Replied 19 May 2002 20:56:01
19 May 2002 20:56:01 Matthijs Horsman replied:
Maybe this one helps...
&lt;HEAD&gt;
&lt;SCRIPT LANGUAGE="JavaScript"&gt;
function scaletofit()
{
var imgwidth = imgobj.width+10;
var imgheight = imgobj.height+29;
window.resizeTo(imgwidth,imgheight);
}
&lt;/SCRIPT&gt;
&lt;/HEAD&gt;
&lt;BODY bgcolor="#FFFFFF" marginwidth=0 marginheight=0 onLoad="scaletofit()"&gt;
&lt;img src="mypicture.jpg" name=imgobj&gt;

&lt;/BODY&gt;

note that i didn't test it, i just stumbeld into it on

www.djjean.com

(doesn't work on NS 4.7 & 6.2, maybe there's a workaround for the ResizeTo... i think there is... but i am no JavaScript expert)
Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl


Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl

Edited by - matthijshorsman on 19 May 2002 21:01:54

Edited by - matthijshorsman on 19 May 2002 21:02:12
Replied 20 May 2002 19:57:55
20 May 2002 19:57:55 Ivan Halen replied:
Uhm... I tested the JavaScript but it doesn't work: it's a pity becouse it seems to be just what I was looking for...

Replied 20 May 2002 19:59:28
20 May 2002 19:59:28 Matthijs Horsman replied:
Maybe you can take a look for your self on www.djjean.nl and go to the photo's. Everytime you click one it pop's up and resizes.

Be sure to put the codes in the pop-up window!

NOTE: Doesn't work in NS (at all)

Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl

Edited by - matthijshorsman on 20 May 2002 20:00:16
Replied 21 May 2002 10:06:32
21 May 2002 10:06:32 Ivan Halen replied:
Matthijs, your script is simply G R E A T!
It works very fine, it's just what I was looking for! I use it in connection with the "Open Browser Window" Behavior to have a window without nav bar, status bar, etc...
It has a wonderful integration with ASP code and it has only a few lines of script...
More, I can change the "imgobj.height+29" line to have more space on the popup page (to write a description of the picture or to put a "close" button)
What else can I say? You solved my problems, a very very big THANK YOU!

Replied 21 May 2002 14:42:37
21 May 2002 14:42:37 Matthijs Horsman replied:
Haha, it aint my script, i just keep my eyes wide open during surfing....

Glad you like it....

Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl
Replied 21 May 2002 16:41:57
21 May 2002 16:41:57 Matthijs Horsman replied:
Found an other one

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

&lt;SCRIPT LANGUAGE="JavaScript"&gt;&lt;!--
function resizeWindow() {
if (document.images) {
if (windowHandle.document.images.length == 1) {
if (document.layers) windowHandle.resizeTo(windowHandle.document.images[0].width+20,windowHandle.document.images[0].height+20)
else if (document.all) windowHandle.resizeTo(windowHandle.document.images[0].width+30,windowHandle.document.images[0].height+50)
}
else
setTimeout('resizeWindow()',1000);
}
}


//--&gt;&lt;/SCRIPT&gt;

&lt;FORM&gt;

&lt;INPUT TYPE="BUTTON" VALUE="Image1" onClick="windowHandle = window.open('image1.gif','windowName','width=100,height=200,resizable=yes');setTimeout('resizeWindow()',2000)"&gt;
&lt;INPUT TYPE="BUTTON" VALUE="Image2" onClick="windowHandle = window.open('image2.gif','windowName','width=200,height=200,resizable=yes');setTimeout('resizeWindow()',2000)"&gt;

&lt;/FORM&gt;

i found it on www.irt.org

there's a LOT there...

<img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle><img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

I think this one works in NS 4 also...

Matthijs
----------------
UD4/WY2K/IIS/ASP-VB
www.chaps.nl
Replied 21 May 2002 18:21:18
21 May 2002 18:21:18 Ivan Halen replied:
uhm... the last one doesn't work on my browser: popup window doesn't resize according to images... the first one is still the best I saw <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Reply to this topic