

|
  
>"; // text displayed in the next field
$last="<"; // text displayed in the last field
$textlinks=1; // display textlinks to the images 1=yes 0=no
$dropdown=0; // display dropdown menu with names 1=yes 0=no
$dropdowntext="show"; // text display on the button next to the dropdown
$namedisp=0; // display name of the pic (capitalized filename) 1=yes 0=no
$xofy=1; // display pic x of y 1=yes 0=no
$SCRIPT_NAME=$SERVER_VARS['PHP_SELF'];
$pic=$HTTP_GET_VARS['pic'];
// the directory name
$handle=opendir('.');
// start HTML, you can tweak that!
echo "\n\t \n";
// initialize variables
$pics=array();
$count=0;
// read directory into pics array
while (($file = readdir($handle))!==false) {
// filter for jpg, gif or png files...
if (substr($file,-4) == ".jpg" || substr($file,-4) == ".gif" || substr($file,-4) == ".png" || substr($file,-4) == ".JPG" || substr($file,-4) == ".GIF" || substr($file,-4) == ".PNG"){
// you can apply other filters here...
$pics[$count] = $file;
$count++;
// don't forget to close the filter conditions here!
}
}
closedir($handle);
// done reading, sort the filenames alphabetically, shade these lines if you want no sorting
sort($pics);
reset($pics);
// define the selected picture, to highlight textlink, preselect dropdown and define for+next links
for ($f=0;$f<=sizeof($pics)-1;$f++){if ($pic==$pics[$f]){$selected = $f+1;}}
// display dropdown if wanted...
if ($dropdown==1){
echo "\t\t\n\t\t\n\t\t";
}
// if there is already a pic selected...
if ($pic && !preg_match("/javascript/",$pic)){
// if the text should be displayed
if ($namedisp==1){
// Capitalize filename for display andf print it
$name=ucfirst(substr($pic,0,-4));
echo "\n\t\t\n\t\t".$name;
}
// if pic x of y is selected, display it
if ($xofy==1){
echo " ".$selected."/".sizeof($pics);
}
echo "\n\t\t\n";
// Display table with for+next arrows, and a black line around the image
echo "\t\t\n\t\t\n\t\t\t\n\t\t\t\t";
// if for+next arrows are selected and the picture is not the first one, display last arrow
if ($selected != 1 && $fornext==1){
echo "$last";
}
else { echo "$last";}
echo" | \n\t\t\t\t | ";
// if for+next arrows are selected and the picture is not the last one, display next arrow
if ($selected != (sizeof($pics)) && $fornext==1){
echo"\n\t\t\t\t$next";
}
else { echo"\n\t\t\t\t | $next";}
echo" | \n\t\t\t \n\t\t \n\t\t\n\t\t\n\t\t";
}
// if textlinks display is selected
if ($textlinks == 1){
// loop over images
for ($f=0;$f<=sizeof($pics)-1;$f++){
// add gaps between the links, unless it is the first one
if ($f > 0) echo " ";
// if the link to the pic is the selected one, display a bold number and no link
if ($pic==$pics[$f]){echo "".($f+1)."";}
// otherwise display the link
else{echo "".($f+1)."";}
// make linebreaks every 8 times!
$isbr = strpos((($f+1)/8),".");
if (!$isbr){echo " ";}
}
}
// close HTML :-)
echo"\n\t\t\n\t ";
echo "\n\n";
?>
|


 |