GrViewer: Graphics Files Viewer

  // grviewer.php
  // utility to display in a single Web page all graphical images in the 
  //   directory in which this utility resides as a Web page; intended to 
  //   provide a quick reference to all available graphical images, 
  //   particularly those with less-than-descriptive file names
  // Written 4/14/2012, L.Pritchett, Cliffson Solutions, LLC
  // Revised 4/14/2012, L.Pritchett, Cliffson Solutions, LLC

  $aGRAPHICS_EXTENSIONS = array ("gif", "png", "jpg", "jpeg");

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en-gb" lang="en-gb" >

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Graphics Viewer</title>


  printf("  <h3>Graphics in %s%s</h3>\n", $_SERVER['DOCUMENT_ROOT'],

  $hDir = opendir(".");
  while ($sFile = readdir($hDir))
    if (in_array(pathinfo($sFile, PATHINFO_EXTENSION), $aGRAPHICS_EXTENSIONS))
      printf("  <div style=\"border:3px solid #00cccc;margin:20px;" .
      printf("    <img src=\"%s\" alt=\"%s\" />\n", $sFile, $sFile);
      printf("    <br />\n");
      printf("    <br />\n");
      printf("    <span style=\"font-weight:bold;color:#770077;\">%s" .
        "</span>\n", $sFile);
      printf("  </div>\n");