/*
img.php V1.0002 by Sam Rowe 2002 http://www.deadman.org/misc.html
*/
function inline($path){
if(file_exists("$path")){
$size=GetImageSize($path);
printf("
",$path,$size[3]);
}else{
return;
}
}
$image=$_REQUEST['image'];
$dir=".";
$dirh=opendir("$dir");
while (($file = readdir($dirh)) != false) {
if (eregi("\.jpg$|\.png$|\.gif$",$file)){
$images[]=$file;
}
}
closedir($dirh);
natsort($images);
$imgs=array_values($images);
$soi=sizeof($imgs);
?>
if (isset($image)){
for ($x=0;$x<$soi;$x++){
if ( $imgs[$x] == $image ){
$current=$x;
}
}
}else{
$current=0;
}
if ( $current > 0 ){
$previous = $current - 1;
}else{
$previous = 0;
}
$forward=$current + 1;
$end=$soi-1;
$common=$_SERVER['PHP_SELF'].'?image=';
$first=$common.$imgs[0];
$prev=$common.$imgs[$previous];
$curr=$common.$imgs[$current];
if( $current == $end ){
$next=$first;
}else{
$next=$common.$imgs[$forward];
}
$last=$common.$imgs[$end];
?>
<<
<
O
>
>>
+
while(list($x,$value)=each($imgs)){
printf("
%s\n",$imgs[$x],$imgs[$x]);
printf("
here\n",$_SERVER['PHP_SELF'],$imgs[$x]);
}
?>
if ( isset($image) ){
inline($image);
}
?>