Results 1 to 2 of 2

Thread: PHP Photo Album script- naming and displaying

  1. #1
    Join Date
    Jan 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album script- naming and displaying

    PHP Photo Album script (naming),

    Hi everyone,

    I really like this script. Kudos to the coder(s). I was wondering how do i name each image with its original name. example, fido at the hydrant.jpg, fido chasing mailman.jpg. instead of "photo".
    and on a different note: when i choose 3*3 i get 9 images in line vertically. How do i display 3 by 3

    Cheers

    Marc

  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

    3*3 means 9. It is three times three in javascript. The script calls for this syntax:

    Code:
    3x3
    The x in this case is just a delimiter not an operator as the * is.

    About the image captions, I believe you mean. Edit the script here:

    Code:
    function buildimage(i){
    var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
    var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'
    tempcontainer+='<img src="'+imagepath+galleryarray[i][0]+'" title="'+galleryarray[i][0]+' ['+galleryarray[i][1]+']" />'
    tempcontainer+='</a><br />'
    tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : ""
    return tempcontainer
    }
    Replace that red line with this one:

    Code:
    tempcontainer+=galleryarray[i][0];
    I see you are probably using spaces in your filenames. In some browsers they will get escaped and come out as %20 so, use this instead if using filenames with spaces:

    Code:
    tempcontainer+=unescape(galleryarray[i][0]);
    Another nice twist would be to strip the extension (.jpg or .gif) or whatever:

    Code:
    tempcontainer+=unescape(galleryarray[i][0]).replace(/\.[^\.]*$/, '');
    - John
    ________________________

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

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
  •