Enmanuel Soria
01-25-2012, 06:36 AM
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:
eregi($pattern, $file) function is deprecated and as such this script runs no more, at least it wont on my wamp server with php 5.3.8
ive been thinkering with this one and changed the script to :
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname="./") {
$pattern="{".$dirname."*.jpg,".$dirname."*.jpeg,".$dirname."*.png,".$dirname."*.gif,".$dirname."*.bmp}";
$files = array();
$curimage=0;
foreach (glob($pattern,GLOB_BRACE) as $file) {
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo " [$curimage, \"$file\", \"$filedate\"],\n";
$curimage++;
}
echo " [\"placeholder\"]\n";
return($files);
}
$photovar=$_GET['id'];
if (!preg_match("/^([a-zA-Z])([a-zA-Z0-9])+$/", $photovar)){
echo "alert(\"Photo Album ID must contain only letters\")";
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";
?>
and it works or at least seems like it, but i want to know if theres another way around it, a better one perhaps
btw: i may be mistaken but i downloaded the whole script page and the album in the example doesn't seem to be using the script it has a hardcoded object, at least the one i downloaded do.:confused:
PHP Photo Album script v2.11
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm
3) Describe problem:
eregi($pattern, $file) function is deprecated and as such this script runs no more, at least it wont on my wamp server with php 5.3.8
ive been thinkering with this one and changed the script to :
<?php
Header("content-type: application/x-javascript");
function returnimages($dirname="./") {
$pattern="{".$dirname."*.jpg,".$dirname."*.jpeg,".$dirname."*.png,".$dirname."*.gif,".$dirname."*.bmp}";
$files = array();
$curimage=0;
foreach (glob($pattern,GLOB_BRACE) as $file) {
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo " [$curimage, \"$file\", \"$filedate\"],\n";
$curimage++;
}
echo " [\"placeholder\"]\n";
return($files);
}
$photovar=$_GET['id'];
if (!preg_match("/^([a-zA-Z])([a-zA-Z0-9])+$/", $photovar)){
echo "alert(\"Photo Album ID must contain only letters\")";
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";
?>
and it works or at least seems like it, but i want to know if theres another way around it, a better one perhaps
btw: i may be mistaken but i downloaded the whole script page and the album in the example doesn't seem to be using the script it has a hardcoded object, at least the one i downloaded do.:confused: