PDA

View Full Version : Photo Album script pop-up controls



mickharper
07-13-2006, 01:20 PM
1) Script Title: Photo Album script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/photoalbum.htm

3) Describe problem: I am trying to set the characteristics of the pop-up (_new). Basically, I just want the full-size image without scrollers/toolbars/etc in a window that fits it. My javascript knowledge is quite basic, and I tried transferring parts of the code from the PHP Photo Album that allow you to control the pop-up, but to no avail. You can see that in the code here: http://www.themidnighthours.com/index6.htm

I would just use the PHP Photo Album script, but my hosting plan doesnt seem to support it and the images never load.

This seems like it shouldnt be that complicated... but I'm rather ignorant.
Any ideas?

jr_yeo
07-13-2006, 01:41 PM
try this link http://www.sitepoint.com/article/resize-popup-fit-images-size :p

is this what u want? :D

mickharper
07-13-2006, 01:58 PM
ya but im trying to work within the confines of the Photo Album script. How would I integrate that into it?

mickharper
07-13-2006, 01:58 PM
oh and thanks for responding so quickly! i really appreciate it.

jr_yeo
07-13-2006, 02:25 PM
onClick="return popuplinkfunc(this)">
is this a newly added feature? :p

<edit>
anyway, add this

function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open("pop.htm?"+imgsrc.href, "", popupsetting[1])
popwin.focus()
return false
}
else
return true
}
within the

<script type="text/javascript">

/***********************************************
* Photo Album script- ? Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

// more lines of code
</script>


and change the

var popupsetting=[1, "width=200px, height=200px, scrollbars, resizable"]
with

var popupsetting=[1, "resizable=1,HEIGHT=200,WIDTH=200, scrollbars=1"]

untried but should work theoretically :D

jr_yeo
07-13-2006, 02:36 PM
one last thing :p
create a new HTML file with this code inside it


<HTML>
<HEAD>
<TITLE>Fit the Pic Script</TITLE>
<script language='javascript'>
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
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);
self.focus();
};
</script>
</HEAD>
<BODY bgcolor="#000000" onload='FitPic();' topmargin="0"
marginheight="0" leftmargin="0" marginwidth="0">
<script language='javascript'>
document.write( "<img src='" + picUrl + "' border=0>" );
</script>
</BODY>
</HTML>

mickharper
07-13-2006, 02:39 PM
Great, i got it working! www.themidnighthours.com
thanks so much.

jr_yeo
07-13-2006, 02:54 PM
added feature if u want :D

inside the pop.htm add the one in dark red :

document.write( "<img src='" + picUrl + "' border=0 onClick=javascript:window.close()>" );

so that if the user clicks on the image the window closes :D