PDA

View Full Version : PHP Photo Album - Full URL path



zibarak808
09-10-2008, 04:25 PM
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

rangana
09-11-2008, 01:35 AM
Change the buildimage function into:


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:


//Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
var descriptionprefix=[1, "Photo "]


into:


//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.

zibarak808
09-11-2008, 10:48 AM
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

rangana
09-11-2008, 11:44 AM
Change buildpaginate function into:


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):


//Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
var descriptionprefix=[1, "Photo "]


into:


// 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.

zibarak808
09-17-2008, 09:11 PM
I was away for a few days so I just wanted to say thanks again for all your help!