/*----------------------------------------------------------------------------- Script Name: showimages Author: Trevor Staats © 2004 All Rights Reserved Purpose: Build a table of thumbnails and captions to display a photo album. History: -----------------------------------------------------------------------------*/ if ( isset( $_SERVER[ 'QUERY_STRING' ] ) ) parse_str( $_SERVER[ 'QUERY_STRING' ] ); function DisplayImages( $Folder ) { require 'admin/admin.php'; // Gets the header and footer info. require_once('thumb.php'); $TableFont = GetTableFont(); $TextFont = GetTextFont(); $HeaderFont = GetHeaderFont(); $CaptionFileName = GetCaptionFileName(); $FolderName = $Folder; if ( !is_dir( $FolderName ) ) { printf( "Album is not available at present - please try again later" ); exit; } $FileFolder = explode( "/", $FolderName ); // see if we need to create thumbnails first if ( !file_exists( $FolderName."/"."files.csv" ) ) { // Create the thumbnail files and reference file $Dir = opendir( $FolderName ); $Extension = ""; while( $FileName = readdir( $Dir ) ) $FileList[] = $FileName; closedir( $Dir ); for ($i = 0; $i < count( $FileList ); $i++ ) { $FileName = $FileList[ $i ]; if ( strstr( $FileName, "." ) ) { $Extension = explode( ".", $FileName ); if ( ( $Extension[1] == "jpg" or $Extension[1] == "gif" or $Extension[1] == "png") and ( strncmp( $Extension[ 0 ], "th-", 3 ) ) ) { // rename the sucker first $OldName = $FolderName."/".$FileName; $NewName = strtolower( str_replace(" ", "", $FileName) ); rename( $OldName, $FolderName."/".$NewName ); // add it to the captions list $FilesCSV[] = $NewName.",".$Extension[0]; // create the thumbnail create_thumb_wfixed( $FolderName."/".$NewName, $FolderName."/".'th-'.$NewName, 100, 70 ); } } } $fp = fopen( $FolderName."/"."files.csv", "w" ); for ( $i = 0; $i < count( $FilesCSV ); $i++ ) { fputs( $fp, $FilesCSV[ $i ]."\r\n", strlen($FilesCSV[ $i ])+2 ); } fclose( $fp ); } unset( $FileList ); // get a list of eligible files in the folder... $Dir = opendir( $FolderName ); $Extension = ""; while( $FileName = readdir( $Dir ) ) { if ( strstr( $FileName, "." ) ) { $Extension = explode( ".", $FileName ); if ( ( $Extension[1] == "jpg" or $Extension[1] == "gif" or $Extension[1] == "png") and ( !strncmp( $Extension[ 0 ], "th-", 3 ) ) ) { // Only add on graphics files that start with th- (the thumbnails)) $FileList[] = $FileName; } } } closedir( $Dir ); sort( $FileList ); // Include any html header data that is required. $HeaderName = GetHeaderName(); if ( !readfile( $HeaderName ) ); { print( "\n
\n" ); } // Is there any descriptive text to go in? It is in%s%s
%s", $HeaderFont, $buf, NewLine() ); while( $buf = fgets ($DescFile, 1000 ) ) { printf( "%s%s
%s", $TextFont, $buf, NewLine() ); } } print( "$TableFont | ",
// $FolderName, "/", $BigFile,
// $FolderName, "/", $File,
// $Caption );
printf( "$TableFont | ",
"showsingleimage.php?FolderName=$FolderName&Index=$BigFile",
$FolderName, "/", $File,
$Caption );
}
print( "