PDA

View Full Version : PHP Photo Album Script - Nothing shows up after install



beck.thomson
03-03-2008, 07:43 PM
1) Script Title: PHP Photo Album Script

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

3) Describe problem:

Despite having gone over the implementation directions and my own modifications SUPER carefully, I'm getting zero results from this script. Nothing shows up at all... no errors, nothing.

Before posting this, I was searching the forums for possible fixes, and made one or two small modifications to the php script, but nothing helped.

The files can be found here:

http://www.legacystudies.org/galleries/general.html
http://www.legacystudies.org/galleries/getpics.php

I'd appreciate any help I can get here... I'm totally baffled. :confused:

jscheuer1
03-04-2008, 04:35 AM
One major problem is that there appear to be no image files in this folder:


http://www.legacystudies.org/galleries/

As a result:


http://www.legacystudies.org/galleries/getpics.php

has nothing to find there. Your script code would seem to indicate that the image files are actually here:


http://www.legacystudies.org/galleries/general/

If so, the external tag calling getpics.php should be:


<script src="general/getpics.php" type="text/javascript"></script>

and getpics.php should be in that folder.

There could still be other problems.

beck.thomson
03-05-2008, 04:02 PM
Well, that seems to have done it. I guess I figured that as long as I referenced getpics.php correctly, it wouldn't be an issue. The thing is, if I want to have more than one photo gallery in different folders, will I need to copy the php file into each of those folders now?

Thanks so much for your help... I was totally stymied. :rolleyes:

jscheuer1
03-05-2008, 07:32 PM
if I want to have more than one photo gallery in different folders, will I need to copy the php file into each of those folders now?

Yes, that's the way that it works. If you are much up on PHP, you could modify getpics.php to accept a query to tell it which folder to look in. I'm not though, so what follows is just my best guess. The basic concept though would be to use the PHP GET to get the folder from a script tag with a src attribute like:


<script src="getpics.php?folder=general" type="text/javascript"></script>

Then in getpics.php, this line would receive that info:


function returnimages($dirname=".") {

by being modified something like:


function returnimages($dirname="./" . $_GET["folder"] . "/") {

beck.thomson
03-05-2008, 11:16 PM
Yeah, PHP isn't really my strong point either.

One last question--do you know whether it's possible with this script to specify custom captions for each photo?

jscheuer1
03-06-2008, 01:56 AM
On the PHP issue - I just tested it, and it did not work. However, this did - instead of making the change to getpics that I thought, do this, change:


function returnimages($dirname=".") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";

to:


function returnimages() {
$dirname="./" . $_GET["folder"] . "/";
$pattern="\.(jpg|jpeg|png|gif|bmp)$";

As to your other question, captions? Sure we can do just about any sort of captions that you like. But I would need to know where these captions should appear, and what the typical content of the captions would be, as well as how you want to define the captions.

With this script, the easiest way to define captions is as a subset of each image's filename. Like if you want a caption:

Great Image!

The image should be called:

Great_Image!.jpg

Working on that basis, if you want the captions to appear below the images in the gallery itself, you would edit this line in the script:


tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : ""

to be like so:


tempcontainer+=galleryarray[i][0].replace(/_|(\..*)/g,' ');

If there is something else that you have in mind, or you have any problems with implementing this let me know.