Vasilli
08-21-2003, 09:34 PM
Hi all
I have been trying to get this ting to work for ages, and i can't figure out why it is being so annoying :)
what i am trying to do is create a type of mini gallery that will display a few images on a page. i have installed a copy of Albinator to a page i bulit befor this and from doing that i am compelled to create my own (just a much simpler and smaller one ;) ) But i have found that i have fallen into a hole and i can't crawl out.
in essence what i am trying to do is bulid an array of the images in a directory. ie loop through the directory and add the files to an array, then loop through the array and count the files, and then place them onto the page like so
Image 1 image 2 image 3
image 4 image 5 ......
and so on
Sounds simple (sorta) but that is what i got, it shoudl work, but doesn't, and i am sure i am overlooking something, prolly a real basic thing, but i am stumped.
any help would be great, thanks
<?php
$folder = 'images/';
if (is_dir($folder)){
$vOpenedDir = opendir($folder);
echo "\n\n<table bgcolor=\"#ffcc00\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">\n\t<tr>\n\t\t";
while (($file = readdir($vOpenedDir)) != false) {
$sDirItem = $folder.$file;
if ($file != "." && $file != "..");
{
$ct = array($file);
$iCounter = 0;
for ($iCounter = 0; $iCounter < count($ct) ; $iCounter++)
{
$ct[$iCounter] = ($iCounter + 1);
if ($file % 3 == 0)
{
echo "\t</tr>\n\t<tr>\t\t";
}
}
$sBuild = "\n\t\t";
$sBuild .= "<td align=\"center\" valign=\"middle\" style=\"border: 1px solid #666666\">";
$sBuild .= "\n\t\t";
$sBuild .= "<img src='". $folder . $file . "' width='90'><br>".$file ;
$sBuild .= "\n\t\t";
$sBuild .= "</td>\n";
echo $sBuild;
}
}
closedir($vOpenedDir);
echo "\t</tr>\n</table>";
}
I have been trying to get this ting to work for ages, and i can't figure out why it is being so annoying :)
what i am trying to do is create a type of mini gallery that will display a few images on a page. i have installed a copy of Albinator to a page i bulit befor this and from doing that i am compelled to create my own (just a much simpler and smaller one ;) ) But i have found that i have fallen into a hole and i can't crawl out.
in essence what i am trying to do is bulid an array of the images in a directory. ie loop through the directory and add the files to an array, then loop through the array and count the files, and then place them onto the page like so
Image 1 image 2 image 3
image 4 image 5 ......
and so on
Sounds simple (sorta) but that is what i got, it shoudl work, but doesn't, and i am sure i am overlooking something, prolly a real basic thing, but i am stumped.
any help would be great, thanks
<?php
$folder = 'images/';
if (is_dir($folder)){
$vOpenedDir = opendir($folder);
echo "\n\n<table bgcolor=\"#ffcc00\" cellpadding=\"2\" cellspacing=\"2\" width=\"100%\">\n\t<tr>\n\t\t";
while (($file = readdir($vOpenedDir)) != false) {
$sDirItem = $folder.$file;
if ($file != "." && $file != "..");
{
$ct = array($file);
$iCounter = 0;
for ($iCounter = 0; $iCounter < count($ct) ; $iCounter++)
{
$ct[$iCounter] = ($iCounter + 1);
if ($file % 3 == 0)
{
echo "\t</tr>\n\t<tr>\t\t";
}
}
$sBuild = "\n\t\t";
$sBuild .= "<td align=\"center\" valign=\"middle\" style=\"border: 1px solid #666666\">";
$sBuild .= "\n\t\t";
$sBuild .= "<img src='". $folder . $file . "' width='90'><br>".$file ;
$sBuild .= "\n\t\t";
$sBuild .= "</td>\n";
echo $sBuild;
}
}
closedir($vOpenedDir);
echo "\t</tr>\n</table>";
}