Photos

A number of photographs are now available. More photographs will be linked to as they become available. If you have any photographs you would like to contribute you may email them (or a link to them) to the happy couple (please indicate if you are happy for them to appear online here or else where)

Starting...
"; if (file_exists($folder)) { $handle=opendir($folder); //open the image folder if ($handle) { // if the folder exists we'll read through each file to find the ones which are images if ($DEBUG) print "Directory found
"; $exts=explode(' ',$exts); while (false !== ($file = readdir($handle))) { //loop through files in directory foreach ($exts as $ext) { if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive $files[]=$file; //image file $i++; } } } closedir($handle); //don't need it anymore if ($DEBUG) print "Number of image files-1 ".$i."
"; if ($i>-1) { //we found at least one image file mt_srand((double)microtime()*1000000); // seed for PHP < 4.2 $rand = mt_rand(0, $i); // $i was incremented as we went along if ($DEBUG) print "Chosen file ".$files[$rand]."
"; // Attempt to read the exif information from the file to get a title if (exif_imagetype($folder.$files[$rand])==IMAGETYPE_JPEG) { if ($DEBUG) print "Dealing with a jpg
"; if ($DEBUG2) { $exif=exif_read_data($folder.$files[$rand],0,true); foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name: $val
\n"; } } } $ifd0=exif_read_data($folder.$files[$rand],"IFD0",true); if ($DEBUG) print "Embedded Title ".$ifd0['IFD0']['ImageDescription']."
"; $title=htmlspecialchars($ifd0['IFD0']['ImageDescription']); } $descfile=$files[$rand].".txt"; //description file is the image filename with .txt appended if ($DEBUG) print "Description file ".$descfile."
"; if (!$title && file_exists($folder.$descfile)) { //check if there is a description file $handle=fopen($folder.$descfile,"r"); //attempt to open the description file if ($handle) { // success! there is an associated description if ($DEBUG) print "Description file found
"; $desc=fread($handle,filesize($folder.$descfile)); //read the title in fclose($handle); //done with the file if ($desc) { //got some description $title=$desc; //which becomes the title of the photo } if ($DEBUG) print "Title is ".$title."
"; } } // At this point we have at least one image file in the specified directory and have chosen one at random, for which we've read in the title from the description file, if it exists. So now we'll built the output img html and print it if (!$title) { if ($DEBUG) print "Using generic title
"; $title="A randomly chosen image of the day"; //generic photo title } if ($DEBUG) print "Done, output HTML
"; $imghtml="

\"Photo:

"; // Photo: title print $imghtml; } } } if ($DEBUG2) { print "
Running PHP Info:

"; phpinfo(); } ?>