Results 1 to 5 of 5

Thread: PHP Photo Album - Full URL path

  1. #1
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile PHP Photo Album - Full URL path

    1) Script Title: PHP Photo Album

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

    3) Describe problem:

    Hi all,

    Hopefully this is a simple enough problem for code experts to solve. I've installed the script and it's working perfectly. However I'd like for the full URL path to the image to display beneath the thumbnails instead of the default "Photo 1" etc.

    For example:
    http://www.mysite.com/images/selectedimage.jpg

    Apologies if this is already documented here, I couldn't find it.

    Thanks

    Z

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Change the buildimage function into:
    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 />'
    if(descriptionprefix[0]==0)
    tempcontainer+=imagepath+galleryarray[i][0];
    else if(descriptionprefix[0]==1)
    tempcontainer+=descriptionprefix[1]+(i+1);
    else
    tempcontainer+='';
    return tempcontainer
    }
    The above changes makes use of descriptionprefix value 0 to use URL path and 1 to use the "Text to show".

    With that said, change this part:
    Code:
    //Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
    var descriptionprefix=[1, "Photo "]
    into:
    Code:
    //Toggle image description: descriptionprefix[0 or 1]
    // If 0, the image path is used. Use this as an example descriptoinprefix=[0];
    // If 1, the text prefix value on the right is used. An example is descriptionprefix=[1,'Prefix Text ']
    var descriptionprefix=[0]
    Hope it helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

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

    zibarak808 (09-11-2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Thank you

    Rangana,

    Thank you very much for your help. That worked perfectly. I have one other request if it's not too much trouble. I'd like to prefix and suffix the image path with <img src=" and /> so that the string can be copied and pasted as an image link.

    Again, thank you for your help!

    Z

  5. #4
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Change buildpaginate function into:
    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 />'
    if(descriptionprefix[0]==0)
    tempcontainer+=imagepath+galleryarray[i][0];
    else if(descriptionprefix[0]==1)
    tempcontainer+=descriptionprefix[1]+(i+1);
    else if(descriptionprefix[0]==2)
    tempcontainer+='<img src="'+imagepath+galleryarray[i][0]+'">';
    else
    tempcontainer+='';
    return tempcontainer
    }
    ...the above changes could accpet values 0, 1 and 2 as the prefix value.
    0 - Use the full URL path of the image.
    1 - Use a text + the index of the image. Should show "Prefix"[n]
    2 - Include a tag on the prefix. Should show <img src="">

    With that said, once again, change this part (from DD's original):
    Code:
    //Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
    var descriptionprefix=[1, "Photo "]
    into:
    Code:
    // Toggle image description: descriptionprefix[0 or 1]
    // If 0, the image path is used. Use this as an example descriptoinprefix=[0];
    // If 1, the text prefix value on the right is used. An example is 
    descriptionprefix=[1,'Prefix Text ']
    // If 2, the text prefix will show an image tag plus the URL
    
    var descriptionprefix=[2]
    Hope that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. The Following User Says Thank You to rangana For This Useful Post:

    zibarak808 (09-17-2008)

  7. #5
    Join Date
    Sep 2008
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I was away for a few days so I just wanted to say thanks again for all your help!

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
  •