ok I have been building my own image gallery and so far i have this....
gallery.php - will search the /gallery/ folder. Any subfolders are assumed a gallery. It will go inside the gallery folder and find details.txt and pull out the Title, Date, Summary and also print the first thumb image. thumb1.jpg for example.
I may make this a random image from thumbs dir later.
then on clicking on the link to the gallery it will load /gallery/galleryname/index.php
in this page i have a script I have written that will go into /img/ and list all the files /img/$file then it will print the image of thumbs/$file (these must be the same name) and link to ?page=whatever.
THIS WORKS FINE!!
at the moment i have the link created index.php?page=$file
and i can get the imgs to print HOWEVER to do that i put it before the close function and it prints them ALL! How can i make it only print the image i have clicked on?
This is my code so far for index.php... gallery.php is working fine.
the structure is
/img/images.jpg
/thumbs/images.jpg
index.php
I want each image page to show the galleries thumbnails too... but i want to just be able to upload the images and thumbs and the whole thing to work. without having to edit anything because im travelling at the moment and i just want to be able to log in at a net cafe and upload.
// Define the full path to your folder from root
$path = "./img/";
// Open the folder
$dir_handle = @opendir($path) or die("Unable to open $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<a href=\"index.php?page=$file\"><img src=\"thumbs/$file\" border=1></a><br>";
}
// Close
closedir($dir_handle);
// Links
if(isset ($page))
{
if ($page == "$file")
{
echo "<img src=\"img/$file\" border=1>";
}
else {
}
}