Advanced Search

Results 1 to 6 of 6

Thread: Help with PHP Photo Album script

  1. #1
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Help with PHP Photo Album script

    Hi there

    I love the PHP Photo Album script on here but i was wondering if anyone could help me add a few tweaks. I would like to add code that allowed the user to go to any url I state instead of a bigger version of the thumbnail. At the moment there is only one global function on all the thumbnails the script generates and they can only link to bigger version of themselves, in a specified folder. Does this make sense to anyone?
    I do not know enough php to even begin to modify the script.

    Thanks for your help

  2. #2
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 956 Times in 945 Posts
    Blog Entries
    15

    Default

    Warning: Please include a link to the DD script in question in your post, in this case: http://www.dynamicdrive.com/dynamici...photoalbum.htm See this thread for the proper posting format when asking a question.

    Sure, to get each thumbnail to link to the desired URL, firstly, at the top of your page, define an array of links that should be associated with each thumbnail based on their position:

    Code:
    <script type="text/javascript">
    
    var photolinks=[]
    photolinks[0]="http://cnn.com"
    photolinks[1]="http://javascriptkit.com"
    photolinks[2]="http://dynamicdrive.com"
    photolinks[3]="http://cssdrive.com"
    //and so on
    
    </script>
    Then, to get the first thumbnail to click through to the first link, the 2nd the 2nd link etc, inside the script, find the line:

    Code:
    var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'
    and change that to:

    Code:
    var tempcontainer='<a href="'+photolinks[i]+'" target="'+href_target+'">'
    That should do it.

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    pushpull (07-22-2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks ddadmin

    I will try and let you know how it works

    cheers

  5. #4
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default More Help please

    Script: PHP Photo Album script
    http://www.dynamicdrive.com/dynamici...photoalbum.htm


    Yes that works great. I have two more queries if that is ok?

    1. How can i make each image have its own description, would i define an array for var descriptionprefix ?

    2.And lastly how would i make the description words appear at the top of the images instead of the default (which is appear at the bottom of the images)

    Thank you for your patiance

  6. #5
    Join Date
    Aug 2004
    Posts
    9,878
    Thanks
    3
    Thanked 956 Times in 945 Posts
    Blog Entries
    15

    Default

    Regarding 1) and 2) above, try defining a custom array to hold the descriptions:

    Code:
    <script type="text/javascript">
    
    var photodesc=[]
    photodesc[0]="some text"
    photodesc[1]="some text"
    photodesc[2]="some text"
    photodesc[3]="some text"
    //and so on
    
    </script>
    Then, change the earlier modification:

    Code:
    var tempcontainer='<a href="'+photolinks[i]+'" target="'+href_target+'">'
    to instead:

    Code:
    var tempcontainer=photodesc[i]+'<br /><a href="'+photolinks[i]+'" target="'+href_target+'">'

  7. #6
    Join Date
    Jul 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Script: PHP Photo Album script
    http://www.dynamicdrive.com/dynamici...photoalbum.htm

    That worked great. I think i am starting to understand how the code in the script works.
    Could i ask a few more questions please?

    1. How can i have more than one gallery on a page? All under a separate heading for e.g if i had four folders (each with a different name) birds, animals, fish, humans etc. I have tryed to create arrays of the var imagepath function but it does not work. What i would like to do is have four different headings, then create four separate galleries that load on the same page.

    Do i create another tempcontainer?

    Thanks for your patience as i am learning alot

Tags for this Thread

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
  •