$dirpath = "E:/www.mortgageforce.net/images/conference_2009/";
$dh = opendir($dirpath);
$filecount=0;
while (false !== ($file = readdir($dh))) {
//exclude subdirectories
if (!is_dir("$dirpath/$file"))
{
$filecount++;
}
}
closedir($dh);
$maxperpage=20; //Maximum number of thumbnails to display on a page
$pages=intval(($filecount/$maxperpage)+1); //Number of pages
if(!isset($_REQUEST['pageno']) || empty($_REQUEST['pageno']))
{
$pageno=1;
}
else
{
$pageno=$_REQUEST['pageno'];
}
$lastimage=$pageno*$maxperpage;
$firstimage=$lastimage-($maxperpage-1);
if($lastimage>$filecount)
{
$lastimage=$filecount;
}
//echo $i." ".$pages;
$dh = opendir($dirpath);
$count=1; //Deal with number of thumbs on a row
$maincount=1; //Overall count
while (false !== ($file = readdir($dh))) {
//Don't list subdirectories
if (!is_dir("$dirpath/$file") && $file != "Thumbs.db")
{
if($maincount>=$firstimage && $maincount<=$lastimage)
{
if($count>5)
{
$count=1;
}
if($count==1)
{
echo "";
}
$txt = htmlspecialchars(ucfirst(preg_replace('/\..*$/', '', $file)));
list($width, $height, $type, $attr) = getimagesize($dirpath.$file);
if($width>$height)
{
echo ".$file.") | ";
}
else
{
echo ".$file.") | ";
}
if($count==5)
{
echo " ";
}
$count++;
}
$maincount++;
}
}
closedir($dh);
//Now deal with next and previous buttons
if($pageno>1)
{
$prev=$pageno-1;
$btn.="<< Previous";
}
$btn.= " ".$pageno." of ".$pages." ";
if($pageno<$pages)
{
$next=$pageno+1;
$btn.="Next >>";
$btn.=" Last >|";
}
?>
|
|