kuau
12-18-2011, 06:16 PM
1) Script Title: PHP Photo Album script
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
3) Describe problem: I am using an old version of this script with some customizations added by John Scheuer. I don't want to upgrade because I don't like LightBox and the old script does exactly what I want (thanks to John). At one point the descriptions stopped showing and it turned out to be because I had used a relative path to targetlinkdir so John changed one line of code so the path wouldn't matter. I started noticing that this new version caused (I'm assuming) the image description not to show up the first time you clicked on a thumbnail, but it would show up the second time. I'm hoping this is easily fixable but it makes no sense to me. On some of my old sites it works just fine, but when I use the old code on the new site, the same problem manifests. I swear I didn't change anything but the one line, and then I changed it back and used an absolute path.. same problem. How did I break it?!
Here is the script that seems to be causing the problem...
function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var desc='';
for (var i = galleryarray.length-1, lookup = imgsrc.href.replace(targetlinkdir,'') ; i > -1 ; --i)
//for (var i = galleryarray.length-1, lookup = imgsrc.href.replace(/^.*\//,'') ; i > -1 ; --i) [ this is the new code ]
if(galleryarray[i][0]==lookup)
desc=galleryarray[i][1];
var popwin=open('', "popwin", popupsetting[1]);
popwin.document.write('<title>'+desc+
'<\/title><body style="margin:0;padding:0;font:85% sans-serif;text-align:'+
'center;overflow:auto;background-color:#0b151e;color:#cccccc;"><img title="'+
desc+'" alt="Larger Image" style="margin:2px 0;" src="'+imgsrc.href+'"><br>'+desc);
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}
and this is the script on the page that shows the thumbnails...
var popupsetting=[1, "width=694px, height=700px, scrollbars, resizable"]
var descriptionprefix=[0, ""]
var gsortorder=""
var targetlinkdir="http://www.website.com/img/"; //large images
(function(){
for (var i = galleryarray.length-1, j ; i > -1 ; --i)
for (j = slides.length-1 ; j > -1 ; --j)
if(slides[j][0].replace(/^.*\//,'') == galleryarray[i][0])
galleryarray[i][1]=slides[j][1];
})();
It's driving me crazy. Thanks, e :)
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
3) Describe problem: I am using an old version of this script with some customizations added by John Scheuer. I don't want to upgrade because I don't like LightBox and the old script does exactly what I want (thanks to John). At one point the descriptions stopped showing and it turned out to be because I had used a relative path to targetlinkdir so John changed one line of code so the path wouldn't matter. I started noticing that this new version caused (I'm assuming) the image description not to show up the first time you clicked on a thumbnail, but it would show up the second time. I'm hoping this is easily fixable but it makes no sense to me. On some of my old sites it works just fine, but when I use the old code on the new site, the same problem manifests. I swear I didn't change anything but the one line, and then I changed it back and used an absolute path.. same problem. How did I break it?!
Here is the script that seems to be causing the problem...
function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var desc='';
for (var i = galleryarray.length-1, lookup = imgsrc.href.replace(targetlinkdir,'') ; i > -1 ; --i)
//for (var i = galleryarray.length-1, lookup = imgsrc.href.replace(/^.*\//,'') ; i > -1 ; --i) [ this is the new code ]
if(galleryarray[i][0]==lookup)
desc=galleryarray[i][1];
var popwin=open('', "popwin", popupsetting[1]);
popwin.document.write('<title>'+desc+
'<\/title><body style="margin:0;padding:0;font:85% sans-serif;text-align:'+
'center;overflow:auto;background-color:#0b151e;color:#cccccc;"><img title="'+
desc+'" alt="Larger Image" style="margin:2px 0;" src="'+imgsrc.href+'"><br>'+desc);
popwin.document.close();
popwin.focus();
return false;
}
else
return true;
}
and this is the script on the page that shows the thumbnails...
var popupsetting=[1, "width=694px, height=700px, scrollbars, resizable"]
var descriptionprefix=[0, ""]
var gsortorder=""
var targetlinkdir="http://www.website.com/img/"; //large images
(function(){
for (var i = galleryarray.length-1, j ; i > -1 ; --i)
for (j = slides.length-1 ; j > -1 ; --j)
if(slides[j][0].replace(/^.*\//,'') == galleryarray[i][0])
galleryarray[i][1]=slides[j][1];
})();
It's driving me crazy. Thanks, e :)