This is PHP (3 or 4 actually) => see http://www.php.net/ See http://web-file-viewer.sourceforge.net/ for details. Data you can adapt: */ $max_col_number=4; # Maximum number of columns in the table // Icon path directory: $icP=".img"; // Colors: $Color=Array("text" => "#000000", "bgcolor" => "#FFFFFF", "link" => "#000000", "vlink" => "#000000", "alink" => "#000000", "shift" => "#80BBFF", "box" => "White", "highlight" => "#FF0000", "em" => "#504050", "low" => "#D0D0D0"); $max_width=160; # Maximum width for thumbnails (in pixels) $max_height=160; # Maximum height for thumbnails (in pixels) $max_x2display=2600; # Maximum image width to display (in pixels) $max_size2display=1000; # Maximum file size to display (in kBytes) $min_height2target=350; # Minimum height for pictures to set a anchor # Filenames filters (case insensitive regular expresions to exclude): $filter=Array("^\.", "\.ico$", "css$", "index\.*", "CVS"); $confile=".wfvrc.php"; # Specific directory configuration file (optional) $globconf=".wfvgrc.php"; # Global configuration filename $global_intro=".global-intro.html"; # Introduction HTML file $dir_intro=".dir-intro.html"; # Introduction HTML file $thumbdir=".thumbs"; # Thumbnails directory #$refresh_delay=60; # Number of seconds to wait before refresh // ****** End of what users can change (use configuration files as well) ******* $DEBUG=($SERVER_NAME=="bigpix.localdomain"); # Debug mode #$DEBUG=0; # Constants for HTML <-> texte translations: if (function_exists('get_html_translation_table')) { $TXT2HTML=get_html_translation_table(HTML_ENTITIES); $HTML2TXT=array_flip($TXT2HTML); } # Because it is not in PHP3: function inArray ($x, $arr) { $L=sizeof($arr); for ($i=0; $i<$L; $i++) if ($arr[$i]==$x) return true; return false; } # For a better presentation of errors: function error ($msg) { echo "
$msg\n\tPlease, go back.
\n\n"; #echo "\n"; exit; } # For a better presentation of warnings: function warning ($msg) { echo "
$msg
\n\n"; } # Display information in DEBUG mode: function comment ($debug_msg, $indent_string='') { global $DEBUG; if ($DEBUG) echo "$indent_string\n"; } # Display variable content in DEBUG mode: function dispVar ($var_name) { global $DEBUG, $$var_name; comment("Dv: $var_name = ".$$var_name); } dispVar("REQUEST_URI"); $dir_name=$REQUEST_URI; $dir_name=ereg_replace("\?.*$", "", $dir_name); # Hide parameters dispVar("dir_name"); $dir_name=ereg_replace("^.*://[^/]*/", "", $dir_name); # Hide domain name dispVar("dir_name"); #$dir_name=ereg_replace("/$", "", $dir_name); $dir_name=ereg_replace("/[^/]*$", "", $dir_name); dispVar("dir_name"); if (isset($f)) { if (ereg("\/", $f)) $d=ereg_replace("\/[^\/]*$", "", $f); else $d=""; } dispVar("d"); dispVar("PHP_SELF"); $this_file=ereg_replace("^.*/", "", $PHP_SELF); dispVar("this_file"); $h1_title="/".basename($dir_name); dispVar("h1_title"); if ($h1_title=="/") $h1_title="/$HTTP_HOST"; if (!$d) $d="."; else { $dir_name.="/$d"; $h1_title.="/$d"; } $h1_title=ereg_replace('_', ' ', $h1_title); $h1_title=ereg_replace('/', " / ", $h1_title); #$page_title=$h1_title; $page_title=basename($h1_title); dispVar("page_title"); // Read the configuration file: // - the global one: if (is_readable($globconf)) { include "$globconf"; comment("Global configuration file: \"$globconf\" read"); } // - the directory specific one: $confile="$d/$confile"; if (is_readable($confile)) { include "$confile"; comment("Configuration file: \"$confile\" read"); } $nbfilters=sizeof($filter); if ($DEBUG) { for($j=0; $j<$nbfilters; $j++) echo "\n"; # Debug display } $Ext=Array( "text" => Array("txt", "sh", "csv", "conf", "cfg", "ini", "sql", "btab"), "img" => Array("jpg", "jpeg", "gif", "png"), "snd" => Array("aiff","aif","wav","mp3","au"), "mov" => Array("mov","mp4","avi","wmv","rm","mpg","3gp","dv") ); /* This does not work in case of non root web directory: $dirs=explode("/", $dir_name); $L=sizeof($dirs); $h1_title=implode(" / ", $dirs); $h1_title=$L." ".implode(" / ", $dirs); $link=""; $h1_title=""; for($i=1; $i<$L; $i++) { $dir=$dirs[$i]; $link.="/$dir"; if ($i+1<$L) $addon="$dir"; else $addon=$dir; $h1_title.="/ $addon "; } */ #if (isset($f)) $page_title=ereg_replace(".*\/", "", $f); #else $page_title=ereg_replace(".*\/", "", $dir_name); #else $page_title=ereg_replace("^[ \t>]+", '', strtr($h1_title, $HTML2TXT)); #else $page_title=ereg_replace('/', ' > ', $d); if ($d!=".") $page_title=basename($d); dispVar("page_title"); if (empty($page_title)) $page_title=$HTTP_HOST; if (empty($h1_title)) $h1_title=$HTTP_HOST; // Security check: if (ereg("\.\.", $d) || ereg("^/", $d)) { $alert=true; $page_title="$d Access denied!"; $h1_title="Unauthorized access detected!"; } // Set colors (example: textCol="White"): reset($Color); while(list($type, $color)=each($Color)) ${$type."Col"}=$color; ?> <?echo $page_title?> 0) echo " \n"; // Here is the style sheet where you can change the decoration: ?> \n\n"; ?>

Parent"; echo " |\n"; echo "\tTop"; } else echo "\t "; ?> 0) { $unit="second"; if ($refresh_delay>=3600 && $refresh_delay%3600==0) { $refresh_delay/=3600; $unit="hour"; } else if ($refresh_delay>=60 && $refresh_delay%60==0) { $refresh_delay/=60; $unit="minute"; } if ($refresh_delay>1) $unit.="s"; else $refresh_delay=""; echo "( Auto refresh every $refresh_delay $unit )"; } else echo " "; ?>
1024) { $file_size=(int)($file_size/1024); $unit="k"; } $extl=strToLower($ext); if (inArray($extl, $Ext["img"])) { # Get the images width & height: $size=@getImageSize($file); if (is_array($size)) { $width=$size[0]; $height=$size[1]; $reduce=" ".$size[3]; $type=$size[2]; $comment=$width."x$height $file_size$unit"; # Retreive EXIF information if available (JPEG only): $exif_data=""; /* if ($type==2 && function_exists('read_exif_data')) { $exif=read_exif_data($file); $exif_data="/ "; while(list($k,$v)=each($exif)) if ($k!="Thumbnail") $exif_data.="$k: $v / "; #$exif_data=substr($exif_data, -3); } */ $alt=ereg_replace("[-_]", ' ', $sufx); $title="$name ($comment)"; $name=ucfirst($name); echo " \"$alt\"\n
\n"; } else $title="Image does not exist!"; echo " $title
\n"; echo " ".nl2br($exif_data)."
\n\n"; } elseif (inArray($extl, $Ext["text"])) { echo "
\n"; $fcontent = join( '', file( $file ) ); if (eregi("\n", $fcontent); $fcontent = preg_replace( '/([">]) /', "\\1 ", $fcontent); $fcontent = preg_replace( '/ ([":;!])/', " \\1", $fcontent); $fcontent="

\n$fcontent

"; } ?>

Show/Download this file as plain text ]

\n\n"; echo "
\n"; } else { ?>

Download  ]

\n"; readfile($global_intro); echo " \n\n"; } # Insert the introduction file if it exists in the current directory: $dir_intro="$d/$dir_intro"; if (!empty($dir_intro) && file_exists($dir_intro)) { echo " \n"; readfile($dir_intro); echo " \n\n"; } ?> 1024) { $file_size=(int)($file_size/1024); $unit="k"; } if ($file_size>1024) { $file_size=(int)($file_size/1024); $unit="M"; } } # If we need a new line: if (!$nb_td) { echo " "; $tr_closed=0; } else echo "\t"; echo ""; if (++$nb_td>=$max_col_number) { # End of line: echo "\n"; $tr_closed=1; $nb_td=0; } else echo "\n\t"; comment("Before last continue!"); continue; } if (!is_readable($thumb) && ($width>$max_width || $height>$max_height)) { if ($width-$max_width<$height-$max_height) $reduce=" height=$max_height"; else $reduce=" width=$max_width"; }*/ echo "($comment)
\n"; echo "\t \"$alt\"\n";
"; } elseif (inArray($extl, $Ext["snd"])) { echo "
"; if (!$isDir) echo"
"; } elseif (inArray($extl, $Ext["mov"])) { echo "
"; if (!$isDir) echo"
"; } else { echo "
"; if (!$isDir) echo"
"; } echo "$name"; if ($isDir || !empty($ext)) echo "$sep$ext
"; if (!$isDir) echo "
($file_size$unit)"; echo "
"; if (++$nb_td>=$max_col_number) { echo "\n"; $tr_closed=1; $nb_td=0; } else echo "\n\t"; } if (!$tr_closed) { echo "\n"; $tr_closed=1; } } else if (!$dir) error("\"$d\" directory does not exists!"); ?>

"; $extl=strtolower($ext); if (inArray($extl, $Ext["text"])) $link="?f=$file"; if ($isDir) $name="(Folder)'. "
\n\t\t$name"; # Is this a showable image file? if ($ext=="url") { $fid=fopen($file, 'r'); $link=fgetss($fid, 512); fclose($fid); $link=trim($link); echo ""; $name="[External link]'. "
\n\t\t$name"; } elseif (inArray($extl, $Ext["img"])) { #$link="?f=$file"; $name=ucfirst($name); # Get the images width & height: if ($file_size) { $size=getImageSize($file); $width=$size[0]; $height=$size[1]; $reduce=" ".$size[3]; #$type=$size[2]; $comment=$width."x$height"; } else $comment="File empty!"; if ($height>$min_height2target) $link.=""; $alt="Loading..."; $title=$comment; # Get the thumbnail if it exists: #$thumb=ereg_replace("(/[^/]*)$", "/$thumbdir\\1", "$file"); $thumb="$d/$thumbdir/$basename"; #dispVar("reduce"); # If image file is empty or too big: if (!is_readable("$thumb")) { if(!file_exists("$d/$thumbdir")) { mkdir ("$d/$thumbdir",0777); } $thumbwidth = 160; $thumbheight = 160; $srcname = "$d/$basename"; //$cmd = "$srcname -thumbnail ".$x_size."x".$y_size." $thumb"; //$w = "/usr/bin/convert $cmd > ./log.txt 2>&1"; //system("echo $PATH"); //$ret = system($w); // //元の画像のサイズを求める list($old_width, $old_height, $old_type, $old_attr) = getimagesize($srcname); //画像の縮小 $src_im = ImageCreateFromJPEG($srcname);//元画像 $dst_im = ImageCreate($thumbwidth, $thumbheight);//先画像 if($old_width<$old_height){//縦が長い ImageCopyResized($dst_im, $src_im, 0, 0, 0, ($old_height-$old_width)/2, $thumbwidth, $thumbwidth, $old_width, $old_width); }else{//横が長い ImageCopyResized($dst_im, $src_im, 0, 0, ($old_width-$old_height)/2, 0, $thumbheight, $thumbheight, $old_height, $old_height); } ImageJPEG($dst_im, $thumb); ImageDestroy($dst_im); ImageDestroy($src_im); //echo "$w
"; //chmod($thumb,0757); system("chmod og+w $thumb"); } #comment("Thumbnail detected."); if ($width>$max_x2display) $link="$file"; $file=$thumb; $reduce=""; /*} else if ((!$file_size || $width>$max_x2display || ($unit=="k" && $file_size>$max_size2display))) { comment("Thumbnail absent."); if ($file_size) echo ""; echo $name; if ($file_size) echo "
"; echo "$sep$ext
\n"; echo "\t ($comment - $file_size $unit)