My idea is to have a catalogue on the webb server.
Lets call it "photoalbum"
In this catalogue there are an unknown number of catalogues whith unknown names.
In these catalogues there are an unknown number of pictures (gif/jpg/bmp) with unknown filenames.
I would like to iterate through "photoalbum" and for each catalogue found therein a link will be created with the catalogues name. When clicking on this a new page will open where all the pictures are thumbnails.

Can anyone give any pointers or tell me if this isnt possible at all.
😕

    Its possible - the only thing you need to decide is whether you need your thumbnail an actual reduces physical size of the original image. If you do you will need a third party extension for PHP - usually GD is used for this type of thing. You could however just set size constrains on the original image.

    The looping and reading of the directory is quite simple as as the linking - but you need to make the above decision.

    looping and printing your directory:

    $dir = opendir("/images"); // or whatever you directory is
    while ($file = readdir($dir)) {
      echo '<a href="'.$file.'" target="_blank">'.$file.'</a><br>';
    }
    closedir($dir);
    

    you could pretty this up by adding the contents to an array and sorting it in alphabetical order, you could also remove the file extension.

    Hope this help slightly 🙂

      Originally posted by kock1
      Jippikayey

      Hmmm.... is this a positive reply? 🙂

        Yeah, I left out the rest of the sentence.
        So this is truly a happy response.😃

          This is the (so far) final result:
          (please inform as how to insert the strings into an array and sorting it)

          <? 
          $path="";
          $path2="";
          if(isset($_GET['path'])){
          	$path = $_GET['path'];
          }
          else{
          	$path = "PhotoAlbum"; 
          }
          
          if(isset($_GET['Action'])){
          	$Action = $_GET['Action'];
          }
          else{
          	$Action = ""; 
          }
          echo "$Action<br>";
          $dir = @opendir("$path"); 
          while (($file = readdir($dir)) !== false) { 
          	if($file != "." && $file != "..") {
          		if ($Action=="OpenSubDir")
          		{
          			print("<img Class='ThumbNail' src='$path\\$file'><br>");
          
          	}
          	elseif ($Action=="")
          	{
          		print("<a href='PhotoAlbum.php?path=$path\\\\$file&Action=OpenSubDir'>$file</a><br>"); 
          	}
          } 
          }
          closedir($dir); 
          ?>
          

            In your loop - insteed of outputing the files just add them to an array: then use sort() or rsort() (reverse sort) to order them, then finaly loop the array and output it as before. 🙂

              Write a Reply...