Hey guys
I am trying to get this script just to show one image, basically at the moment it reads the folder specified as $dir and displays every image in there... how can i restrict the amount of images shown?
this is above the page
On the pagePHP Code:<?php
$login = $_GET['login'];
$NBFile=0;
$dir ="clients/$login";
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$FileArray[] = $dir."/".$file;
$NBFile=$NBFile+1;
}}}
closedir($handle);
?>
PHP Code:<?php
$NBPicswidth=1;
$NBPics=0;
for ($i=0; $i<$NBFile; $i++
)
{
$image=$FileArray[$i];
echo "<img src='$image'>";
$NBPics=$NBPics+1;
if ( $NBPics==$NBPicswidth )
{
$NBPics=0;
}
}
?>



Reply With Quote




Bookmarks