PDA

View Full Version : Photo Album script v2.0 is not working :(



dream
09-11-2012, 01:34 PM
I wanted to put this on my project for my gallery page. But it isn't working. I tried running the page on different browsers (Google Chrome, Mozilla Firefox, Opera), but still, the page contains nothing at all. Please help me! I really wanted this kind of photo album. Thank you!

jscheuer1
09-11-2012, 02:18 PM
Please post about Dynamic Drive Scripts in the Dynamic Drive Scripts Help section here where I've moved this thread, and:

Warning: Please include a link to the DD script(s) in question in your post. See this post (http://www.dynamicdrive.com/forums/showpost.php?p=7) for more information.

The script requires a PHP enabled server and will not run locally or on a server that's not PHP enabled. Are you running it on a PHP enabled server?

If not, you need to. However, if you are running it on a PHP enabled server, the getalbumpics.php is a little dated. Here's a more modern version:


<?php
Header("content-type: application/x-javascript");
if (phpversion() >= 5.1){
@date_default_timezone_set(date_default_timezone_get());
}

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

$photovar=$_GET['id'];
if (!preg_match('/^[a-z_][a-z0-9_]+$/i', $photovar)){
echo 'alert("Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number")';
die();
}
echo "var $photovar={\n";
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
echo " images: [\n";
returnimages();
echo " ],\n";
echo " desc: []\n";
echo "}\n";
die();
?>

Try it. The browser cache may need to be cleared and/or the page refreshed to see changes.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.