Not apropos to this discussion as a solution, rather as an example for one aspect of it (a fairly complex external javascript file written in PHP), here's an external javascript that's called with a query as to what the name of the array you want produced is:
PHP Code:
<?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();
?>
For more info on how this file is used, see:
http://www.dynamicdrive.com/forums/s...674#post225674
and the script it's used with:
http://www.dynamicdrive.com/dynamici...photoalbum.htm
Which also has a less compatible, but perhaps easier to follow version of the code:
http://www.dynamicdrive.com/dynamici...umpics.php.txt
Bookmarks