Go Back   Dynamic Drive Forums > DD Scripts > Dynamic Drive scripts help
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-10-2008, 05:59 PM
master1425 master1425 is offline
New Comer (less than 5 posts)
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help adding Lightbox and PHP Photo Album

1) Script Title: Lightbox Image Viewer 2.03a + PHP Photo Ablum Script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...photoalbum.htm
http://www.dynamicdrive.com/dynamici...box2/index.htm

3) Describe problem:

Ok, sorry to post another one of these posts... but I've read through all of them I can find, but still cant quite get to the point I want.

Heres where I stand:

I have successfully added the lightbox and PHP photo album together. However, I want to get rid of the "Photo 1, Photo 2... etc" titles, and I'd also like to be able to add a "description" into the lightbox when you click the image.

I've read through the forum, and this post came closest to what I wanted:
http://www.dynamicdrive.com/forums/s...ad.php?t=33205

This is My site: http://www.winfieldfiredept.com/2008comp.html

It looks like that user eventually got exactly the same thing Im looking for, however, I couldnt follow along with the thread, because somewhere some files were modified that I didnt see.

Here is what I've got:

Head:
Code:
<head>

<title>WFD</title>
<link rel="stylesheet" type="text/css" href="newwfdstyle.css">

<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="js/lightbox.js"></script>

<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />


<script type="text/javascript" src="photogallery.js">

/***********************************************
* Photo Gallery Script v2.0- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>


<style type="text/css">

.slideshow{ /*CSS for DIV containing each image*/
float: left;
margin-right: 10px;
margin-bottom: 10px;
}

.slideshow img{ /*CSS for each image tag*/
border: 0;
width: 131px;
height: 98px;
}

#navlinks{ /*CSS for DIV containing the navigational links*/
width: 400px;
}

#navlinks a{ /*CSS for each navigational link*/
margin-right: 8px;
margin-bottom: 3px;
font-size: 110%;
}

#navlinks a.current{ /*CSS for currently selected navigational link*/
background-color: white;
}
</style>

</head>
Body:
Code:
<script src="08comp-thumbs/getpics.php" type="text/javascript"></script>

<script type="text/javascript">

/***********************************************
* PHP Photo Album script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

var dimension="4x5" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
var imagepath="http://www.winfieldfiredept.com/08comp-thumbs/" //Absolute path to image directory. Include trailing slash (/)
var href_target="new" //Enter target attribute of links, if applicable

//Toggle popup link setting: popupsetting[0 or 1, "pop up window attributes" (if 1)]
var popupsetting=[1, "width=500px, height=400px, scrollbars, resizable"]

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

//Sort images by date? ("asc", "desc", or "")
//"desc" for example causes the newest images to show up first in the gallery
//"" disables this feature, so images are sorted by file name (default)
var gsortorder="asc"

//By default, each image hyperlinks to itself.
//However, if you wish them to link to larger versions of themselves
//Specify the directory in which the larger images are located
//The file names of these large images should mirror those of the original
//Enter a blank string ("") to disable this option
var targetlinkdir="http://www.winfieldfiredept.com/08comp/"

/////No need to edit beyond here///////////////////

function sortbydate(a, b){ //Sort images function
if (gsortorder=="asc") //sort by file date: older to newer
return new Date(a[1])-new Date(b[1])
else if (gsortorder=="desc") //sort by file date: newer to older
return new Date(b[1])-new Date(a[1])
}

if (gsortorder=="asc" || gsortorder=="desc")
galleryarray.sort(sortbydate)

var totalslots=dimension.split("x")[0]*dimension.split("x")[1]

function buildimage(i){
var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" rel="lightbox[roadtrip]" 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
}

function jumptopage(p){
var startpoint=(p-1)*totalslots
var y=1;
for (i=0; i<totalslots; i++){
document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
}
while(document.getElementById("navlink"+y)!=null){
document.getElementById("navlink"+y).className=""
y++
}
document.getElementById("navlink"+p).className="current"
initLightbox();
}

var curimage=0
for (y=0; y<dimension.split("x")[1]; y++){
for (x=0; x<dimension.split("x")[0]; x++){
if (curimage<galleryarray.length)
document.write('<div id="slide'+curimage+'" class="slideshow">'+buildimage(curimage)+'</div>')
curimage++
}
document.write('<br style="clear: left" />')
}

function popuplinkfunc(imgsrc){
if (popupsetting[0]==1){
var popwin=open(imgsrc.href, "popwin", popupsetting[1])
popwin.focus()
return false
}
else
return true
}

</script>

<!--Below HTML code refers to the navigational links for the gallery-->

<div id="navlinks">
<script type="text/javascript">
for (i=1; i<Math.ceil(galleryarray.length/totalslots)+1; i++)
document.write('<a id="navlink'+i+'" href="javascript:jumptopage('+i+')\">Page'+i+'</a> ')
document.getElementById("navlink1").className="current"
</script>
</div>
Current getpics.php
Code:
<?
Header("content-type: application/x-javascript");

function returnimages($dirname=".") {
   $pattern="\.(jpg|jpeg|png|gif|bmp)$";
   $files = array();
   $curimage=0;
   if($handle = opendir($dirname)) {
       while(false !== ($file = readdir($handle))){
               if(eregi($pattern, $file)){
		 $filedate=date ("M d, Y H:i:s", filemtime($file));
                 echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
                 $curimage++;
               }
       }

       closedir($handle);
   }
   return($files);
}

echo "var galleryarray=new Array();" . "\n";
returnimages();
?>
As far as I can remember, I dont think I have edited "Lightbox.js, prototype.js, scriptaculous.js, so they should all be the same as when installed.

I saw in one thread, that the "getpics.php" file was modified, so that you had to type out every picture in order to get the titles and description. Im fine with doing that, and would actually prefer it, so that I can arrange my pictures in order better.

Any help is greatly appreciated.
Reply With Quote
  #2  
Old 07-11-2008, 08:12 AM
ddadmin's Avatar
ddadmin ddadmin is offline
Administrator
 
Join Date: Aug 2004
Posts: 7,627
Thanks: 2
Thanked 639 Times in 629 Posts
Blog Entries: 13
Default

I haven't really studied John's solution you cited in that thread.

Quote:
However, I want to get rid of the "Photo 1, Photo 2... etc" titles
That part is easy, as inside PHP Photo Gallery script, you can disabled the description:

Code:
//Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
var descriptionprefix=[0, "Photo "]
Regarding showing a description within Lightbox, that's where things get more complicated obviously. How do you envision specifying the description for each image, for example, manually via JavaScript (to then be passed into Lightbox), or are you looking for some way to automate that process on the server side as well?
Reply With Quote
  #3  
Old 07-11-2008, 06:54 PM
master1425 master1425 is offline
New Comer (less than 5 posts)
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh sorry, I didnt really elaborate that great on what I was trying to do.

I dont really want to "remove" the "photo 1, photo2" option. I want to replace it with my own title. However, thats not really as important to me as being able to put a description inside the lightbox frame.

Quote:
Regarding showing a description within Lightbox, that's where things get more complicated obviously. How do you envision specifying the description for each image, for example, manually via JavaScript (to then be passed into Lightbox), or are you looking for some way to automate that process on the server side as well?
To accomplish this, I would like to manually enter it. I imagine it might have something to do with changing

getpics.php to something like this (this was taken from Jalonis's thread)
Quote:
var galleryarray=new Array();
galleryarray[0]=["wagleytimmytommypet.jpg", "May 13, 2008 09:40:47", "Wagley's Pets Timmy and Tommy"];
galleryarray[1]=["kellydobiepet.jpg", "Jun 04, 2008 09:04:47", "Kelly's Pet Dobie"];
galleryarray[2]=["dailchloe2pet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Chloe Picture 2"];
galleryarray[3]=["dailbetsy3pet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Betsy Picture 3"];
galleryarray[4]=["dailbetsy2pet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Betsy Picture 2"];
galleryarray[5]=["dailearlgertrudepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pets Earl and Gertrude"];
galleryarray[6]=["dailgypsyrose2pet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Gypsy Rose Picture 2"];
galleryarray[7]=["dailgagitpet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Gagit"];
galleryarray[8]=["dailchloecharliepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pets Chloe and Charlie"];
galleryarray[9]=["dailgertrude2pet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Gertrude Picture 2"];
galleryarray[10]=["dailgypsyrosepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Gypsy Rose"];
galleryarray[11]=["dailmaggiepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Maggie"];
galleryarray[12]=["dailgertrudepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Gertrude"];
galleryarray[13]=["dailcharliepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Charlie"];
galleryarray[14]=["suittearlcharliepet.jpg", "Jun 04, 2008 09:04:47", "Suitt's Pets Earl and Charlie"];
galleryarray[15]=["dailchloemaggiepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pets Chloe and Maggie"];
galleryarray[16]=["dailchloepet.jpg", "Jun 04, 2008 09:04:47", "Dail's Pet Chloe"];
galleryarray[17]=["dailjkpet.jpg", "Apr 27, 2008 01:02:47", "Dail's Pet Jk"];
galleryarray[18]=["dailbetsypet.jpg", "Apr 27, 2008 01:03:47", "Dail's Pet Betsy"];
galleryarray[19]=["jamiepet.jpg", "Jun 04, 2008 09:04:47", "Jamie's Pet"];
galleryarray[20]=["jscharboroughmaggiepet.jpg", "Jun 04, 2008 09:04:47", "Uncle Joe's Pet Maggie"];
galleryarray[21]=["mileymay08.jpg", "May 01, 2008 09:04:47", "Cindy's Pet Miley"];
galleryarray[22]=["ellisonflossiepet.jpg", "Oct 02, 2005 04:41:00", "Ellison's Pet Flossie"];
galleryarray[23]=["miley06-05-08.jpg", "Jun 05, 2008 00:00:00", "Miley wants to help you!"];
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:23 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.