PDA

View Full Version : PHP Photo Album script v2.11



MacTrom
10-16-2010, 09:06 PM
1) Script Title: PHP Photo Album script v2.11

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

3) Describe problem:
I'm confused on where the files go in ref to the gallery photos.

Do I separate albums into subfolders?

I have the following file heirarchy:


Files:
getalbumpics.php
ddphpalbum.js
ddphpalbum.css
289321-R1-05-5.jpg
289321-R1-04-4.jpg
289321-R1-03-3.jpg
289321-R1-02-2.jpg
289321-R1-01-1.jpg
289321-R1-00-0.jpg

saigon/

289321-R1-09-9.jpg
289321-R1-01-1.jpg
289321-R1-02-2.jpg
289321-R1-03-3.jpg
289321-R1-04-4.jpg
289321-R1-05-5.jpg
289321-R1-06-6.jpg
289321-R1-07-7.jpg
289321-R1-08-8.jpg
...
289322-R1-10-10.jpg
289322-R1-11-11.jpg
289322-R1-12-12.jpg
289322-R1-13-13.jpg
289322-R1-14-14.jpg
289322-R1-15-15.jpg
289322-R1-16-16.jpg
terry.html

terry.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="../getalbumpics.php?id=saigon"></script>

<script type="text/javascript">

//Optional, manual description for particular pictures inside album
//Syntax: albumid.desc[index]="Picture description here"
//eg: myvacation.desc[2]="This is description for the 3rd picture in the album"
//eg: myvacation.desc[6]="This is description for the 7th picture in the album"

</script>

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

/***********************************************
* PHP Photo Album script v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/

</script>

<link rel="stylesheet" type="text/css" href="../ddphpalbum.css" />
<style type="text/css">
@import url(../font_styles.css);
div.lpxcenterpageouter { text-align: center; position: absolute; top: 0px; left: 0px; width: 100% }
div.lpxcenterpageinner { position: relative; margin: 0 auto; text-align: left; width: 790px; }
</style>

</head>
<body onUnload="" alink="#6633CC" onLoad="" id="element1" link="#3333CC" bgcolor="#BEC4FD" scroll="auto" vlink="#6633CC">
Photos by Terry Romine
<div style="border: thin solid blue; width:600px;">
<script type="text/javascript">

new phpimagealbum({
albumvar: saigon, //ID of photo album to display (based on getpics.php?id=xxx)
dimensions: [3,2],
sortby: ["file", "asc"], //["file" or "date", "asc" or "desc"]
autodesc: "Photo %i", //Auto add a description beneath each picture? (use keyword %i for image position, %d for image date)
showsourceorder: true, //Show source order of each picture? (helpful during set up stage)
onphotoclick:function(thumbref, thumbindex, thumbfilename){
thumbnailviewer.loadimage(thumbref.src, "fit2screen")
}
})

</script>
</div>
</body>
</html>


it works but only shows the photos in the directory where the scripts are, instead of the photos in the saigon folder where the terry.html file is.

http://458thseatigers.org/photos/terry/saigon/terry.html

Thanks
Terry

jscheuer1
10-17-2010, 04:27 AM
Solution:

Put a copy of getalbumpics.php in the saigon folder and on the page 458thseatigers.org/photos/terry/saigon/terry.html change this:


<script type="text/javascript" src="../getalbumpics.php?id=saigon"></script>

to:


<script type="text/javascript" src="getalbumpics.php?id=saigon"></script>



Explanation:

This (from the source code of 458thseatigers.org/photos/terry/saigon/terry.html linked to in your post):


<script type="text/javascript" src="../getalbumpics.php?id=saigon"></script>

points to a file named getalbumpics.php in a folder that is a parent of the current folder. The ?id=saigon only tells it what to name the javascript object containing the array of images it will make. The current folder is:

458thseatigers.org/photos/terry/saigon/

So that would be the file getalbumpics.php in the terry folder (parent folder of saigon) that it's pointing to. The getalbumpics.php file only fetches images from its location, in this case the terry folder. And this is the javascript object, including the array of images that it makes:


var saigon={
baseurl: "http://458thseatigers.org/photos/terry/",
images: [
[0, "289321-R1-01-1.jpg", "Oct 16, 2010 15:36:53"],
[1, "289321-R1-04-4.jpg", "Oct 16, 2010 15:37:11"],
[2, "loading.gif", "Oct 16, 2010 14:34:34"],
[3, "289321-R1-05-5.jpg", "Oct 16, 2010 15:37:11"],
[4, "289321-R1-02-2.jpg", "Oct 16, 2010 15:37:00"],
[5, "289321-R1-03-3.jpg", "Oct 16, 2010 15:36:58"],
[6, "289321-R1-00-0.jpg", "Oct 16, 2010 15:36:48"],
["placeholder"]
],
desc: []
}

There is no getalbumpics.php file in the saigon folder. If there were, you could access it from the page 458thseatigers.org/photos/terry/saigon/terry.html like so:


<script type="text/javascript" src="getalbumpics.php?id=saigon"></script>

And it would return a javascript object named saigon containing an array of images in the current folder, which is the saigon folder. The ?id=saigon part has nothing to do with what folder it's going to look in. It's just the name of the javascript object that it will create.