images9.php to HTML

index

USE AT OWN RISK

Generated: Tue Jul 31 15:22:04 2007 from images9.php 2005/08/05 8 KB bytes.


<html>

<head>
<meta http-equiv="Content-Language" content="en-au">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="refresh" content="90;url=images9.php">

<title>Image 120x90 Index s9</title>

</head>

<body background="images/lotus01.jpg">

<h1 align="center"><b>Image 120x90 Index s9</b></h1>

<p align="center">
<span style="background-color: #FFFFFF">
|* <a href="index.html">
index</a> *|* <a href="imagea9.php"> 
Friday(a)</a> *|* <a href="imageb9.php">
Saturday(b)</a> *|* <a href="imagec9.php">
Sunday(c)</a> *|* <a href="imaged9.php">
Other(d)</a> *|* <a href="imagesa.php">
All Special(s)</a> *|* <a href="imageall.php">
All</a> *|* <a href="imageall9.php">
Recent</a> *|</span></p>

<?php 
$m_folder = 'images/.';
$m_type = 's'; // set the DAY, type of file to find, list ...
$m_row_wrap = 3;
$m_max_out = 9;
$m_td_wid = ' <td width="120">';
$m_img_wid = ' width="160" height="120"';
$m_table = '<table border="2" cellpadding="2" cellspacing="2" width="480">';
$m_td_wida = ' <td width="120">';
$m_img_wida = ' width="120" height="90"';
$m_tablea = '<table border="2" cellpadding="2" cellspacing="2" width="480">';

// variables below filled in during running ...
$m_mostcnt = 0;
$m_mostnam = ' ';
$m_mostarr = array();
$m_msg = ' ';
// $m_show = $_REQUEST["show"]; // lets fetch the variable: REQUEST works for both, POST and GET methods

// function isMyFile( $file, $cls )
// file name of form 'temp' + single-letter [a,b,c...] + number 0000 form + '.jpg'
// *******************************************************************************
function isMyFile( $file, $cls ) {
   $ln = strlen($file);
   if($ln >= (4+1+4+1+3)) {
   $pos = strrpos($file,".");
   $exten = substr($file,($pos+1));
   if( ( substr($file,-4,4) == '.jpg' ) &&
   ( substr($file,0,4) == 'temp' ) ) {
   if( $cls == '?' ) {
   // return all 'temp?????.jpg' files
   return 1;
   } elseif( $cls == substr($file,4,1) ) { // get 'a', 'b', 'c', ... , 's' (sunset 60)
   // got our TYPE
   return 1;
   } // got class, day, set
   } // got 'temp' part
   } // get length
   return 0;
}


// function outOrderList ( $imx, $got_ord, $m_mostarr, $row_wrap, $max_out ) {
function outOrderList ( $imx, $got_ord, $m_mostarr ) {
   global $m_row_wrap, $m_max_out;
   global $m_td_wid, $m_img_wid, $m_table; // like = ' width="160" height="120"';
   $imx2 = $imx; // copy count
   $td_wid = $m_td_wid; // ' <td width="160">';
   $img_wid = $m_img_wid; // ' width="160" height="120"';
   $row_wrap = $m_row_wrap;
   $max_out = $m_max_out;
   if( $got_ord ) {
   $mx_ord = $max_out;
   if( $mx_ord == -1 ) {
   $mx_ord = $imx;
   }
   $got_ord = 0;
 print "<div align=\"center\">\r\n";
   print "<center>\r\n";
   // print "<table border=\"2\" cellpadding=\"2\" cellspacing=\"2\" width=\"480\">\r\n";
   print "$m_table\r\n";
   while($imx2) {
   for($i = 0; $i < $imx; $i++) {
   $arr = $m_mostarr[$i]; // extract array
   if( $arr[3] == $imx2 ) { // found current order
   $date = date("F d Y H:i:s.", $arr[1]);
   $a_msg = '';
   $a_msg .= $arr[0] . ' ';
   $a_msg .= $date . ' '; // = date("F d Y H:i:s.", $arr[1]) . ' ';
   $a_msg .= " $arr[2]";
   $a_msg .= " $arr[3]";

   $m_msg = '';
   if(($got_ord % $row_wrap) == 0) {
   $m_msg .= " <tr>";
   }
   $m_msg .= $td_wid;
   $m_msg .= "<img src=\"$arr[4]\" alt=\"$a_msg\"";
   $m_msg .= $img_wid; // like = " width=\"160\" height=\"120\""
   $m_msg .= ">";
   $m_msg .= "<br><font size=\"-2\">";
   $m_msg .= $arr[0]; // like, temp?nnnn.jpg
   $m_msg .= ' ' . date("H:i:s", $arr[1]);
   //$m_msg .= " $date";
   //$m_msg .= $a_msg;
   $m_msg .= "</font>";
   $m_msg .= " </td>";
   $got_ord++;
   if(($got_ord % $row_wrap) == 0) {
   $m_msg .= " </tr>";
   }
   print "$m_msg\r\n";
   break;
   }
   }
   $imx2--;
   if($got_ord >= $mx_ord) {
   break;
   }
   }

   // fill in any missing SET-OF-?????
   while( $got_ord % $row_wrap ) {
   $m_msg = $td_wid; // = say ' <td width="160">';
   $m_msg .= 'no image';
   $m_msg .= ' </td>';
   $got_ord++;
   if(($got_ord % $row_wrap) == 0) {
   $m_msg .= " </tr>";
   }
   print "$m_msg\r\n";
   }
   print "</table>\n";
   print "</center>\r\n";
   print "</div>\r\n";
   }
}


function getDirList2 ($dirName, $mostrec, $mostnam, $mostcnt, $mostarr, $typ ) { 
 $d = dir($dirName); // note, with '/.' added
 // build up a LIST of directories, and files, in this folder
 while($entry = $d->read()) {
   //$locpath = $dirName."/".$entry;
 $locpath = substr($dirName,0,(strlen($dirName)-1)).$entry;
 if ($entry != "." && $entry != "..") {
 if (is_dir($locpath)) {
 $dirlist[] = $entry;
   } else {
 $fillist[] = $entry;
 } 
 } 
 } 
 $d->close();
 if (isset($fillist)) {
 asort($fillist);
 foreach ($fillist as $fil) {
 // $locpath = $dirName."/".$fil; // note: dir name ends with '/.', guaranteed!!!
 $locpath = substr($dirName,0,(strlen($dirName)-1)).$fil;
 $size = filesize($locpath);
   $filtm = filemtime($locpath);
   if( isMyFile( $fil, $typ ) ) {
   if( $filtm > $mostrec ) {
   $mostrec = $filtm;
   $mostnam = $fil;
   }
   $arr = array();
   $arr[] = $fil; // 'temp' + class + number[1-9999] + '.jpg'
   $arr[] = $filtm; // keep the file time
   $arr[] = $size; // keep file size
   $arr[] = 0; // sort order
   $arr[] = $locpath; // keep WHOLE (relative) name
   // ==================================================
   $mostarr[] = $arr; // keep the files that MATCH class
   $mostcnt++; // bump COUNT
   }
 }
 }
} // end func getDirList2 ($dir, $rec, $nam, $cnt, $arr, $typ )

// *****************************************************************************************
// do the action
getDirList2 ($m_folder, &$m_mostrec, &$m_mostnam, &$m_mostcnt, &$m_mostarr, $m_type );
// *****************************************************************************************
// did we collect the files we need ...
if( $m_mostrec > 0 ) {
   $imx = count( $m_mostarr ); // get COUNT of FOUND ITEMS - full list of arrays
   $imx2 = $imx; // copy count
   $got_ord = 1;
   // SORT the array of files, per their FILETIME
   // interate, finding the most recent, non-ordered, each time
   while($imx2) { // set order to N, N-1, N-2, ..., 1 ... note 1 is last
   $ft = 0; // start with zero time
   $idx = $imx;
   for($i = 0; $i < $imx; $i++) {
   $arr = $m_mostarr[$i]; // extract array
   if( $arr[3] == 0 ) {
   if( $arr[1] > $ft ) { // if later
   $ft = $arr[1]; // get it,
   $idx = $i;   // keeping the index to it
   }
   }
   }
   if( $idx < $imx ) {
   // found highest, latest
   $arr = $m_mostarr[$idx]; // extract array, of file things
   $arr[3] = $imx2; // set ORDER
   $m_mostarr[$idx] = $arr; // replace array, with value update
   // print "<p>Set order $arr[3]!</p>\r\n";
   } else {
   print "<p>No order! Internal error, or filetime is ZERO!</p>\r\n";
   $got_ord = 0;
   }
   $imx2--;
   }

   // outOrderList ( $imx, $got_ord, $m_mostarr, 3, 9 );
   // outOrderList ( $imx, $got_ord, $m_mostarr, 6, $imx );
   outOrderList ( $imx, $got_ord, $m_mostarr );
   $m_msg = "<p>Found $imx files, temp$m_type????.jpg in $m_folder ... ";
   $m_msg .= "Most recent: $m_mostnam ";
   $m_msg .= date("F d Y H:i:s.", $m_mostrec);
   $m_msg .= " ($m_mostrec) of $m_mostcnt ...</p>";
   print "$m_msg\r\n";
} else {
   $m_msg = "<p>No most recent found using $m_folder ...</p>";
   print "$m_msg\r\n";
}

?>
 

<p align="center">
<span style="background-color: #FFFFFF">
|* <a href="index.html">
index</a> *|* <a href="imagea9.php"> 
Friday(a)</a> *|* <a href="imageb9.php">
Saturday(b)</a> *|* <a href="imagec9.php">
Sunday(c)</a> *|* <a href="imaged9.php">
Other(d)</a> *|* <a href="imagesa.php">
All Special(s)</a> *|* <a href="imageall.php">
All</a> *|* <a href="imageall9.php">
Recent</a> *|</span></p>

<p>EOP</p>

</body>
</html>
<!-- 5 August 2005 - images9.php Version 0.0.1 - friendofflowers.com - grm -->

index

Valid HTML 4.01 Transitional