Hello,
I am trying to create a photography gallery and at the minute I have it so it uses session variables to pull the cat titles and where a cat title is present it loops through the folder which is passed from a mysql lookup.
$dir = "photography/".$gallery;
$files1 = scandir($dir);
$picturecount = count($files1) - 3;
$sqlstr = " SELECT * from gallery where FOLDER = '".$gallery."' order by DATED DESC " ;
$link = mysql_connect( "localhost", $user, $pass );
if ( ! link )
die ( "Could not Connect to MYSQL" );
mysql_select_db( $db, $link )
or die ( "Could not open $db: ".mysql_error() );
$result = mysql_query( $sqlstr );
$num_rows= mysql_num_rows( $result );
while ($a_row = mysql_fetch_array( $result ) ) {
$title = $a_row["TITLE"];
echo "<h2>" . $a_row['TITLE'] . "</h2>";
echo "<h7>" . $a_row['NOTES'] . "</h7>";
$dir = "photography/".$a_row["FOLDER"];
echo "<ul>";
}
mysql_close( $link );
foreach ($files1 as &$value) {
if(preg_match("/.jpeg|.jpg|.gif\z/i", $value)){
echo "<li><a rel='gallery_group' href=photography/".$gallery."/".$value."><img src=photography/".$gallery."/thumbs/".$value."></a></li>";
}
}
I have this bit working no problem, if there is a category present it will pull back all the images and thumbnails.
Now I have created the gallery page where I want it to display the category titles and use the scandir with a foreach statement to scan all the folders in a directory and pull back the first file per directory to display. I can't work out for the life of me what it should be. I pull back the titles from a database and it loops through the database to find the records. It is the actual displaying of the thumbnail I can't work out.
Any help appreciated.