Results 1 to 9 of 9

Thread: PHP Photo Album script, opening a page

  1. #1
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album script, opening a page

    Hello,

    I'm using "PHP Photo Album script" (updated code version you posted on this forum) and it works great.
    What I would like to do is to open a php page when clicking on a thumbnail picture and having the url to contain the pic filename (without the .jpg) at the end of it.


    Example :

    I click on thumbnail of a picture named Animals41.jpg and it open in the same window : pictures.php?n=Animals41
    or
    I click a picture named Guitar5.jpg and and it open in the same window : pictures.php?n=Guitar5


    Hope someone can help me
    Thanks you very much :-)
    Last edited by linoux; 10-04-2013 at 10:12 AM.

  2. #2
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok i figured out myself

    Thanks
    Last edited by linoux; 10-04-2013 at 01:34 PM.

  3. #3
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    now I'm trying to do something else, for the past two days I tried but i can't get it working :
    I want to put the actual filenames of the pictures under the thumbnails. I've messed up with autodesc, thumbfilename and even the .js but no luck. Not sure someone will help me

    here is part of working code so far :

    Code:
    <script type="text/javascript">
    
    new phpimagealbum({
    	albumvar: myvacation, //ID of photo album to display (based on getpics.php?id=xxx)
    	dimensions: [4,50],
    	sortby: ["file", "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: true, //Show source order of each picture? (helpful during set up stage)
    onphotoclick:function(thumbref, thumbindex, thumbfilename){
    		
    var test=thumbfilename
    test=test.replace(".jpg","")
    
    		var myurl=" channel.php?n="+test
    		 window.open(myurl, '_self')
     }
    })
    
    </script>
    Thanks

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    You need to edit the script for that. Which version exactly are you using?
    - John
    ________________________

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

  5. #5
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for answering me

    I'm using the version you posted here :

    http://www.dynamicdrive.com/forums/s...-don-t-show-up

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    OK, that's just an update of the getalbumpics.php file to account for changes in PHP. So I'm assuming you're still using the current official version of the ddphotoalbum.js file. And I should have said the script needs to be altered, not necessarily edited.

    If that's the script you're using, just put this script:

    Code:
    <script type="text/javascript">
    phpimagealbum.routines.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 src="' + albumvar.baseurl + albumvar.images[i][1] + '" data-index="' + i +'" />' + (albumvar.images[i][3]? '<br />'+albumvar.images[i][3] : (desc)? '<br>' + albumvar.images[i][1] : '<br>' + albumvar.images[i][1]);
    	};
    </script>
    in the head of the page right after it (right after this):

    Code:
    <script type="text/javascript" src="ddphpalbum.js">
    
    /***********************************************
    * PHP Photo Album script v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/
    
    </script>
    It will change how each image/description pair is rendered, using the image filename as the description. It can be tweaked further if desired.

    The browser cache may need to be cleared and/or the page refreshed to see changes.
    Last edited by jscheuer1; 10-07-2013 at 12:13 AM. Reason: add info
    - John
    ________________________

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

  7. #7
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    it works like a charm, thanks you very much.

    you say it can be tweaked further, the only thing I would tweak more is to remove the ".jpg" in the filenames under the thumbnail,
    I'm trying to find how, don't know if it involve complex changes?
    Last edited by linoux; 10-08-2013 at 12:43 AM.

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,926
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Code:
    <script type="text/javascript">
    phpimagealbum.routines.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] : ""
    			}) : '',
    		filename = albumvar.images[i][1].replace(/\.[^\.]+$/, '');
    		return (showorder? '<b style="color:red">Source Order: '+albumvar.images[i][0]+'</b><br />' : '') + '<img src="' + albumvar.baseurl + albumvar.images[i][1] + '" data-index="' + i +'" />' + (albumvar.images[i][3]? '<br />'+albumvar.images[i][3] : (desc)? '<br>' + filename : '<br>' + filename);
    	};
    </script>
    - John
    ________________________

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

  9. #9
    Join Date
    Oct 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    it works great, it look simple now i see it, I have a lot to learn

    thanks you so much for your help

Similar Threads

  1. PHP Photo Album script v2.11—Categories instead of page numbers?
    By dlowrie in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 03-09-2011, 02:26 PM
  2. PHP Photo Album script v2.11 auto page button issue in IE8
    By xxmewstarxx in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-14-2010, 02:25 AM
  3. Resolved Photo Album Script V2.0 onselectphoto only fires on 1st page
    By jbrooks in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-21-2009, 02:35 PM
  4. PHP Photo Album script - embed image in page
    By MUYRAPIDO in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 07-03-2007, 05:46 AM
  5. Photo Album Script: Add page numbers to top also?
    By dmwhipp in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 05-01-2006, 03:32 PM

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
  •