Results 1 to 5 of 5

Thread: PHP Photo Album script v2.11 & Lightbox V2.04a, problems

  1. #1
    Join Date
    Aug 2010
    Location
    Czech Republic
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question PHP Photo Album script v2.11 & Lightbox V2.04a, problems

    1) Script Title: PHP Photo Album script v2.11 & Lightbox V2.04a, problems

    2) Script URL (on DD): http://www.dynamicdrive.com/forums/s...ad.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...

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2010
    Location
    Czech Republic
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    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
    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 )

    Code:
                  
    <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
    Last edited by jscheuer1; 08-24-2010 at 02:15 AM. Reason: Remove unnecessary links and info

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You are faced with two problems:

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

    2. 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:

    Code:
    <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.
    Last edited by jscheuer1; 08-24-2010 at 07:31 AM. Reason: code improvement
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    skylinex (08-24-2010)

  6. #5
    Join Date
    Aug 2010
    Location
    Czech Republic
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot. It works great!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •