Results 1 to 5 of 5

Thread: Photo Album script

  1. #1
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Photo Album script

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

    I'm a newbie at all this :P So I'm wondering how can you add pictures to pages 2,3,4 etc..?
    And can you change the text 'Page1' 'Page2'?

  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

    You add pictures by adding to the array:

    Code:
    //Specify images:
    //galleryarray[x]=["path_to_image", "optional_title_attribute", "optional_text_description", "optional_link"]
    var galleryarray=new Array()
    galleryarray[0]=["photo1.jpg", "optional title", "optional description", "optional url"]
    galleryarray[1]=["photo2.jpg", "optional title", "optional description", "optional url"]
    galleryarray[2]=["photo3.jpg", "optional title", "optional description", "optional url"]
    galleryarray[3]=["photo4.jpg", "optional title", "optional description", "optional url"]
    galleryarray[4]=["photo5.jpg", "optional title", "optional description", "optional url"]
    galleryarray[5]=["photo6.jpg", "optional title", "optional description", "optional url"]
    galleryarray[6]=["photo7.jpg", "optional title", "optional description", "optional url"]
    galleryarray[7]=["added.jpg", "optional title", "optional description", "optional url"]
    The actual number of images per page is controlled here:

    Code:
    var dimension="3x2" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
    So to add images to a particular page you need to increase the number of images shown per page. To get more control, dummy images may be inserted in the array using a transparent .gif, ex:

    Code:
    galleryarray[2]=["transparent.gif", "", "", ""]
    These will appear as blank areas in the given 'page' that they fall on.

    The text for 'Page1' 'Page2' is generated here on the red line:

    Code:
    <div id="navlinks">
    <script type="text/javascript">
    for (i=1; i<Math.floor(galleryarray.length/totalslots+2); i++)
    document.write('<a id="navlink'+i+'" href="javascript:jumptopage('+i+')\">Page'+i+'</a> ')
    document.getElementById("navlink1").className="current"
    </script>
    </div>
    To change the text displayed, you can edit it like so:

    Code:
    document.write('<a id="navlink'+i+'" href="javascript:jumptopage('+i+')\">Items'+i+'</a> ')
    The above change will yield 'Items1', 'Items2', etc.
    - John
    ________________________

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

  3. #3
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks heaps!!!!
    and if I could ask another question how do you get rid of the optional url?

  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

    The optional fields can be made to 'disappear' as it were, by simply using empty quotes for them in the array, for example:

    Code:
    galleryarray[0]=["photo1.jpg", "optional title", "optional description", "optional url"]
    can become:

    Code:
    galleryarray[0]=["photo1.jpg", "optional title", "optional description", ""]
    if no url is desired.
    - John
    ________________________

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

  5. #5
    Join Date
    Oct 2005
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    great!! thx

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
  •