ClassickJR
08-11-2009, 06:21 AM
1) Script Title: PHP Photo Album script v2.0
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
3) Describe problem:
This problem is only noticeable through MS Internet Explorer, im not sure if it makes a difference which version, but i have ver 8.0.6, which i believe to be the latest, and it still errors. I have tested in FireFox up to version 3.0.1 and it works flawlessly.
The error is visible here: http://sgtclassick.com/gallery/default.php?id=SF_Independent_Spirits_Festival
if you go to that page, youll notice that the layers are all messed up.
This is due to a java script error thrown, which states:
Message: 'images[...].1' is null or not an object
Line: 112
Char: 3
Code: 0
URI: http://sgtclassick.com/gallery/ddphpalbum.js
This is lines 108 - 112 of ddphpalbum.js just to give some context:
buildimage:function(albumvar, i, desc, showorder){
var desc=(desc && desc!="")? '<br />' + desc.replace(/(%i)|(%d)|(%s)/g, function(m){
return (m=="%i")? i+1 : (m=="%d")? albumvar.images[i][2] : ""
}) : ''
return (showorder? '<b style="color:red">Source Order: '+albumvar.images[i][0]+'</b><br />' : '') + '<img rel="facebox" onclick = "document.getElementById(\'fade\').style.display=\'block\'" src="' + albumvar.baseurl + albumvar.images[i][1] + '" data-index="' + i +'" />' + (albumvar.images[i][3]? '<br />'+albumvar.images[i][3] : (desc)? desc : '')
Now, i have been racking my brain about this error and have discovered its source, but i cant for the life of me figure a solution, because as i said, the error is only in IE.
The error is thrown because there are only 8 image files in the directory. If you add one more image to the directory, some how the photodivs.length gets processed correctly, and the 2nd page is created no problems... if there are only 9 images in the directory, then a 2nd page gets created, but it will be empty.
I believe it also has to do with this section of code from ddphpalbum.js ( line 89-99)
gotopage:function(p){
var startpoint=(p-1)*this.photodivs.length
var y=1;
for (var i=0; i<this.photodivs.length; i++){
this.photodivs[i].innerHTML=null
this.photodivs[i].innerHTML=(typeof this.albumvar.images[startpoint+i]!="undefined")? phpimagealbum.routines.buildimage(this.albumvar, startpoint+i, this.autodesc, this.showsourceorder) : ""
}
for (var i=0; i<this.navlinks.length; i++)
this.navlinks[i].className=''
this.navlinks[p-1].className="current"
}
because the javascript error keeps alluding to the fact that images[...].1 is null.
For the time being i suppose i could just make sure i always have 9 or more images in the folders... but if, for example, i changed the images display to show 12 images per page instead of 9, and the folder only had 9 images total, i assume the same problem would occur, because the 1 page wouldnt have enough items to generate a "complete" album page.
Any help is greatly appreciated.
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
3) Describe problem:
This problem is only noticeable through MS Internet Explorer, im not sure if it makes a difference which version, but i have ver 8.0.6, which i believe to be the latest, and it still errors. I have tested in FireFox up to version 3.0.1 and it works flawlessly.
The error is visible here: http://sgtclassick.com/gallery/default.php?id=SF_Independent_Spirits_Festival
if you go to that page, youll notice that the layers are all messed up.
This is due to a java script error thrown, which states:
Message: 'images[...].1' is null or not an object
Line: 112
Char: 3
Code: 0
URI: http://sgtclassick.com/gallery/ddphpalbum.js
This is lines 108 - 112 of ddphpalbum.js just to give some context:
buildimage:function(albumvar, i, desc, showorder){
var desc=(desc && desc!="")? '<br />' + desc.replace(/(%i)|(%d)|(%s)/g, function(m){
return (m=="%i")? i+1 : (m=="%d")? albumvar.images[i][2] : ""
}) : ''
return (showorder? '<b style="color:red">Source Order: '+albumvar.images[i][0]+'</b><br />' : '') + '<img rel="facebox" onclick = "document.getElementById(\'fade\').style.display=\'block\'" src="' + albumvar.baseurl + albumvar.images[i][1] + '" data-index="' + i +'" />' + (albumvar.images[i][3]? '<br />'+albumvar.images[i][3] : (desc)? desc : '')
Now, i have been racking my brain about this error and have discovered its source, but i cant for the life of me figure a solution, because as i said, the error is only in IE.
The error is thrown because there are only 8 image files in the directory. If you add one more image to the directory, some how the photodivs.length gets processed correctly, and the 2nd page is created no problems... if there are only 9 images in the directory, then a 2nd page gets created, but it will be empty.
I believe it also has to do with this section of code from ddphpalbum.js ( line 89-99)
gotopage:function(p){
var startpoint=(p-1)*this.photodivs.length
var y=1;
for (var i=0; i<this.photodivs.length; i++){
this.photodivs[i].innerHTML=null
this.photodivs[i].innerHTML=(typeof this.albumvar.images[startpoint+i]!="undefined")? phpimagealbum.routines.buildimage(this.albumvar, startpoint+i, this.autodesc, this.showsourceorder) : ""
}
for (var i=0; i<this.navlinks.length; i++)
this.navlinks[i].className=''
this.navlinks[p-1].className="current"
}
because the javascript error keeps alluding to the fact that images[...].1 is null.
For the time being i suppose i could just make sure i always have 9 or more images in the folders... but if, for example, i changed the images display to show 12 images per page instead of 9, and the folder only had 9 images total, i assume the same problem would occur, because the 1 page wouldnt have enough items to generate a "complete" album page.
Any help is greatly appreciated.