PDA

View Full Version : Help with PHP Photo Album script



pushpull
07-22-2008, 04:52 PM
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

ddadmin
07-22-2008, 10:03 PM
Warning: Please include a link to the DD script in question in your post, in this case: http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) 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:


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


var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'

and change that to:


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

That should do it.

pushpull
07-22-2008, 10:19 PM
Thanks ddadmin

I will try and let you know how it works

cheers

pushpull
07-22-2008, 11:47 PM
Script: PHP Photo Album script
http://www.dynamicdrive.com/dynamicindex4/php-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

ddadmin
07-23-2008, 06:38 AM
Regarding 1) and 2) above, try defining a custom array to hold the descriptions:


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


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

to instead:


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

pushpull
07-23-2008, 03:25 PM
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