steamngn
06-04-2007, 05:00 PM
Hi gang...
Once again I am in need of the PHP Gods. Have a look at the code below:
if (is_dir($filename) && (!eregi("_vti_cnf",$filename)) && (!eregi("_overlay",$filename)) && (!eregi("_derived",$filename)) && ($filename!=".") && ($filename!="..")) {
$currdir = array();
$gallery = opendir($filename);
$imgcount = 0;
$gallerytitle = $filename . "/gallery.txt";
//loop to count number of images....
while($f = readdir($gallery)){
if(($f != ".") && ($f != "..")&& (eregi("(\.jpg|\.gif|\.png)$", $f))){
//get a random image to display....
array_push($currdir,"$f");
$d = $currdir[(array_rand($currdir))];
$displayimg = sprintf($d,s);
$imgcount++;
}
}
closedir($gallery);
//If the photo folder has a file named 'gallery.txt'
//This will read the first line and stick that text
//into the "alt" of the image (displays on mouseover)
// read title of gallery from gallery.txt
if (file_exists($gallerytitle)) {
$title_file = file($gallerytitle);
$title = $title_file[0];
}
// if no gallery.txt file was found; show user through $title on webpage
else {
$title = "No description for this gallery was provided";
}
The first gallery.txt file returns a string no problem, but subsequent strings are preceeded by some junk that looks like "". Each gallery.txt file is a single line of text with no quotes around it or white space. What in the world is causing this, and how do I get rid of it?
Andy
Once again I am in need of the PHP Gods. Have a look at the code below:
if (is_dir($filename) && (!eregi("_vti_cnf",$filename)) && (!eregi("_overlay",$filename)) && (!eregi("_derived",$filename)) && ($filename!=".") && ($filename!="..")) {
$currdir = array();
$gallery = opendir($filename);
$imgcount = 0;
$gallerytitle = $filename . "/gallery.txt";
//loop to count number of images....
while($f = readdir($gallery)){
if(($f != ".") && ($f != "..")&& (eregi("(\.jpg|\.gif|\.png)$", $f))){
//get a random image to display....
array_push($currdir,"$f");
$d = $currdir[(array_rand($currdir))];
$displayimg = sprintf($d,s);
$imgcount++;
}
}
closedir($gallery);
//If the photo folder has a file named 'gallery.txt'
//This will read the first line and stick that text
//into the "alt" of the image (displays on mouseover)
// read title of gallery from gallery.txt
if (file_exists($gallerytitle)) {
$title_file = file($gallerytitle);
$title = $title_file[0];
}
// if no gallery.txt file was found; show user through $title on webpage
else {
$title = "No description for this gallery was provided";
}
The first gallery.txt file returns a string no problem, but subsequent strings are preceeded by some junk that looks like "". Each gallery.txt file is a single line of text with no quotes around it or white space. What in the world is causing this, and how do I get rid of it?
Andy