$b) ? -1 : 1; } function getPhotosInAlbum( $album ) { $root= "/home/jbf/imageDatabase"; $myDirectory= dir( $root."/".$album ); $result=array(); while( FALSE != ( $entryName= $myDirectory->read() )) { if ( ( $i= strpos( $entryName, ".png", 0 ))==strlen($entryName)-4 ) { if ( strpos( $entryName, ".cache_", 0 )==FALSE ) { array_push( $result, $entryName); } } else if ( ( $i= strpos( $entryName, ".JPG", 0 ))==strlen($entryName)-4 ) { if ( strpos( $entryName, ".cache_", 0 )==FALSE ) { array_push( $result, $entryName); } } else if ( ( $i= strpos( $entryName, ".jpg", 0 ))==strlen($entryName)-4 ) { if ( strpos( $entryName, ".cache_", 0 )==FALSE ) { array_push( $result, $entryName); } } } $myDirectory->close(); rsort($result); return $result; } function getPhotoTimeStamp( $image ) { $root= "/home/jbf/fun/pics/"; $imagejpg= substr( $image, 0, strlen( $image ) - 4 ) . ".JPG"; if ( file_exists( "$root/$imagejpg" ) ) { $lastChange= filemtime( "$root/$imagejpg" ); if ( $lastChange < 1093292700 ) $lastChange= $lastChange + 59460; } else { $fileChange= 0; } return $lastChange; } function checkDrawMeta( $image ) { $root= "/home/jbf/imageDatabase"; $metaFile= "$root/$image.txt"; if ( !is_file( $metaFile ) ) { return; } else { if ( !($myFile=fopen( $metaFile,"r" )) ) { return; } else { $lineNum=1; while( !feof($myFile) ) { $line= fgets( $myFile,255 ); print ($line."
\n"); $lineNum= $lineNum+1; } fclose($myFile); return; } } } function dateCmp($a, $b) { return ($a[0] < $b[0]) ? -1 : 0; } function listDirSorted( $root ) { $myDirectory= dir( $root ); $result=array(); while( FALSE != ( $entryName= $myDirectory->read() )) { if ( substr($entryName,0,1)!="." ) { $timeStamp= filectime($root."/".$entryName); $result[] = array( $entryName, $timeStamp ); } } $myDirectory->close(); rsort( $result ); $result2= array(); while( $x=array_pop($result) ) { #$result2[]= $x[0] . " (" . date( 'Y-m-d h:m', $x[1] ).") "; $result2[]= $x[0] ; } return $result2; } function getAlbums( ) { $root= "/home/jbf/imageDatabase"; $result= listDirSorted( $root ); return $result; } $album=$_GET['album']; $frame= $_GET['frame']; ?> " ); while ( $photoFile= array_pop( $list ) ) { $image= ""; $link= ""; $linkFull= "full resolution"; print( "\n"); } print( "" ); } else { $list= getAlbums(); while ( $album1= array_pop( $list ) ) { $album= $album1; $link= "$album"; print( "\n"); } } ?>
albums>".$album."
$link$image$link$photoFile
$linkFull
albums>".$album."
$link
" ); $image= $_GET['image']; $prevImage=""; $prevGif="noPrev.gif"; $nextImage=""; $nextGif="noNext.gif"; $images= getPhotosInAlbum( $album ); while ( $listImage= array_pop( $images ) ) { if ( $listImage==$image && $lastImage!="" ) { $prevImage= $lastImage; $prevGif="prev.gif"; $prevLink= ""; } if ( $lastImage==$image ) { $nextImage= $listImage; $nextGif="next.gif"; $nextLink= ""; } $lastImage= $listImage; } $rotate= $_GET['rotate']; if ( $rotate=="" ) $rotate=0; $print= $_GET['print']; if ( $print=="" ) $print=0; if ( $print==1 ) { print( "" ); } if ( $image!="" ) { print( "" ); if ( $print==0 ) { print( "\n" ); print( "\n"); } if ( $print==0 ) { print( "\n" ); if ( $print==0 ) { print( "\n" ); } print( "\n" ); print( "
\n" ); print( "

".$album.">".$image."\n" ); print( "

\n"); print( "$prevLink\"previous\n" ); print( "$nextLink\"next\n" ); print( "\n" ); print( "\n" ); print( "
\n"); print( "\n" ); } else { print( "
\n"); print( "\n" ); } print( "
\n" ); print( "print \n" ); if ( $_SESSION['role']=='albumAuthor' ) { $returnUrl= "albumServer.php?frame=content&image=$image&album=$album&rotate=".($rotate); print( "edit \n" ); } $stamp= getPhotoTimeStamp( "$album/$image" ); if ( $stamp>0 ) { print( date( "l F j, Y h:i a", $stamp ) ); } print( "
\n" ); checkDrawMeta( "$album/$image" ); print( "
\n"); print( "" ); } else { print( "" ); if ( $album=="" ) { print( "select an album from the list on the left. Apologies for the list loosing its cronological order. This is associated with a web server upgrade."); } else { print( "select an image from the list on the left"); } print( ""); } if ( $print==1 ) { print( "" ); } print( "" ); } else { /* frames layout */ ?>