USE AT OWN RISK
Generated: Tue Jul 31 15:22:11 2007 from ozimages.php 2005/11/08 2.6 KB bytes.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE>Some OZ Images - August, 2005</TITLE> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <META name="Author" content="Geoff McLane"> <META name="Description" content="Some Australian images, taken August, 2005"> <META name="Distribution" content="Global"> <META name="Keywords" content="Australia, images, August, 2005"> </HEAD> <BODY> <H1 align="center">Some OZ Images - August, 2005</H1> <?php /* ozimages.php AIM: Process a FOLDER, finding JPEG image files ... There should be two(2) copies of each image 1. A thumbnail image - names ?????-t.jpg 2. The full image - full either ?????.jpg or ?????-n.jpg Collect file names, sort, and display thumbnails in a TABLE, each image with a LINK to the FULL IMAGE Geoff McLane - 8 November, 2005 */ $timestart = getmicrotime(); // get time array secs and usecs ... $meol = "\r\n"; $maindir = 'ozimages'; if( !is_dir($maindir) ) { echo "<p>ERROR: Can not OPEN directory [$maindir] ... aborting ... </p>$meol"; exit(3); } $cnt = 0; $in_pat = $maindir . "/*.jpg"; $jpgarr = glob( $in_pat ); if( !$jpgarr || ( count($jpgarr) == 0 ) ) { echo "<p>WARNING: No files matching pattern $in_pat ... aborting ... </p>$meol"; exit(4); } else { sort( $jpgarr ); $acnt = count($jpgarr); $hcnt = floor($acnt / 2); echo "<p>Found $acnt files ... assume $hcnt pairs ... placed in a table</p>$meol"; //foreach ($jpgarr as $fn) { // start the table echo "<div align='center'>$meol"; echo " <center>$meol"; echo " <table border='2' cellpadding='0' cellspacing='0'>$meol"; $cnt = 0; $wrp = 5; for( $i = 0; $i < $hcnt; $i++ ) { $i2 = $i * 2; $cnt++; $fn1 = $jpgarr[$i2]; $fn2 = $jpgarr[$i2+1]; //echo "$cnt $fn1 $fn2<br>$meol"; if( $cnt == 1 ) { echo " <tr>$meol"; // start new row } echo " <td><a target='_blank' href='$fn1'><img border='0' src='$fn2'></a></td>$meol"; if( $cnt == $wrp ) { echo " </tr>$meol"; // close this row $cnt = 0; } } if( $cnt > 0 ) { while( $cnt < $wrp ) { echo " <td><center>no image</center></td>$meol"; $cnt++; } echo " </tr>$meol"; // close this row $cnt = 0; } echo " </table>$meol"; echo " </center>$meol"; echo "</div>$meol"; } $timeend = getmicrotime(); $time = $timeend - $timestart; echo "<p>Script ran for $time seconds ...</p>$meol"; function getmicrotime() { $temparray=split(" ",microtime()); $returntime=$temparray[0]+$temparray[1]; return $returntime; } ?> </BODY> </HTML>