PDA

View Full Version : PHP Photo Album script v2.11 & Lightbox V2.04a, problems



skylinex
08-15-2010, 03:19 PM
1) Script Title: PHP Photo Album script v2.11 & Lightbox V2.04a, problems

2) Script URL (on DD): http://www.dynamicdrive.com/forums/showthread.php?t=50136

3) Describe problem:
Hi, i have a question. Iam displaying small version of image. Onclick i wont to show large version, and I want this lightbox, so i dont know how to make it. Without lightbox it was working of course... And i have one else problem. i have everything set like is here writed.

sortby: ["none", "asc"],
And everything adjusted (ddphpalbum.js, head...). Photos are order in wrong way. "first= last" and "last=first"...
When i change "asc" to "desc" on first look it seems to be right but in lightbox is reverse order. When then I click on first photo lightbox thing it is last photo and i cant go next, only previous. and in bottom left corner is last/all (8/8) but is the first photo! I dont know how to fix it. I even try to order by date or file, but problem persists. And I have everything updated.
Thanks for any help and sorry for my bad english...

jscheuer1
08-15-2010, 04:17 PM
Please post a link to a page on your site that contains the problematic code so we can check it out.

skylinex
08-23-2010, 09:13 AM
Here is the web, (this is not a real web, but if someone solved it, it will work in a real web, wich i am doing... it is in czech language so i make just the problem with lightbox on another adress...) [SNIP . . .] if you need ftp: [SNIP . . .] login is: [SNIP . . .].
So photos are in wrong order, and head, ddphpalbum.js... are adjusted:confused:
It would be sorting by file, or just something that the photos were ranked from 1 to the last. I adjusting photos in Resampler, it changing the date so i can't sort by date.


second problem is i want to in lightbox open photo with normal size (they are with same name in folder "/normal" eg "galerie/lamborghini"=small "galerie/lamborghini/normal/"=normal )




<script type="text/javascript">
(function(groupName){
var d = document.createElement('div'), tmpLink = document.createElement('a'),
lbLink, arObj = window[groupName];
d.style.display = 'none';
tmpLink.rel = 'lightbox[' + groupName + ']';
/* for(var i = 0; i < arObj.images.length-1; ++i){
arObj.desc[i] = arObj.images[i][1];
arObj.desc[i] = arObj.desc[i].substring(0, arObj.desc[i].indexOf('.jpg'));
} */
for(var i = 0; i < arObj.images.length-1; ++i){
lbLink = tmpLink.cloneNode(false);
lbLink.href = arObj.baseurl + arObj.images[i][1];
// if(arObj.desc){
lbLink.title = arObj.images[i][2];
//}
d.appendChild(lbLink);
}
document.body.insertBefore(d, document.body.firstChild);
arObj.hiddenLinks = d.getElementsByTagName('a');
})('lamborghini');

new phpimagealbum({
albumvar: lamborghini, //ID of photo album to display (based on getpics.php?id=xxx)
dimensions: [3,5],
sortby: ["none", "asc"], //["file" or "date", "asc" or "desc"]
autodesc: "Photo %i", //Auto add a description beneath each picture? (use keyword %i for image position, %d for image date)
showsourceorder: false, //Show source order of each picture? (helpful during set up stage)
onphotoclick:function(thumbref, thumbindex, thumbfilename){
Lightbox.box.start(lamborghini.hiddenLinks[thumbindex]);
/* thumbnailviewer.loadimage (adress*thumbfilename, "fit2screen") */
}
})
</script>


Thanks for help

jscheuer1
08-23-2010, 04:01 PM
You are faced with two problems:


The hidden links are no longer in the correct order. So you get the wrong image.


The "Image 1 of 43" part is all messed up, because it's still in the original order.


You also have an unrelated problem in that your full sized images are in another folder.

You can fix all three problems by doing:


<script type="text/javascript">
phpimagealbum.prototype.createHiddenLinks = function(){
var d = document.createElement('div'), tmpLink = document.createElement('a'), lbLink, i, av = this.albumvar;
d.style.display = 'none'; tmpLink.rel = 'lightbox[' + new Date().getTime() + ']';
for(i = 0; i < av.images.length; ++i){
lbLink = tmpLink.cloneNode(false);
lbLink.href = (av.largerimages || av.baseurl) + av.images[i][1];
lbLink.title = av.images[i][2];
lbLink.target = av.images[i][0];
d.appendChild(lbLink);
}
document.body.insertBefore(d, document.body.firstChild);
av.hiddenLinks = d.getElementsByTagName('a');
};

lamborghini.largerimages = 'galerie/Lamborghini/normal/';

new phpimagealbum({
albumvar: lamborghini, //ID of photo album to display (based on getpics.php?id=xxx)
dimensions: [3,5],
sortby: ["none", "desc"], //["file" or "date", "asc" or "desc"]
autodesc: "Photo %i", //Auto add a description beneath each picture? (use keyword %i for image position, %d for image date)
showsourceorder: true, //Show source order of each picture? (helpful during set up stage)
onphotoclick:function(thumbref, thumbindex){
var al = this.albumvar.hiddenLinks, i = al.length - 1;
for (i; i > -1; --i){
if(al[i].target == thumbindex){
Lightbox.box.start(al[i]);
}
}
}
}).createHiddenLinks();
</script>

This should work with any sort order.

Note: The highlighted line:

lamborghini.largerimages = 'galerie/Lamborghini/normal/';

This must point to the larger images folder. It may be a relative path as I've used here, if so, it must be correct for the page this is on. If there is any question, the absolute path may be used. If using the thumbnails as the full size images, simply omit this line.

skylinex
08-25-2010, 10:22 AM
Thanks a lot. It works great!