Gallery-Directory: ".$dirEcho.""; //2. Read this directory recursively $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir) ); //3. Filter only documents with this string $php_files = new RegexIterator($iterator, '/\.jpg$/'); // Filter only ".jpg" //4a. Print Gallery $Columns = 5; //Define number of columns in table, before new row starts echo ""; //Make Table and Text responsive $i = 0; //counter to realize, when its time for new row foreach ($php_files as $file) { if (!$file->isFile()) { continue; }; //Change Path from absolute to relative per File $SlashPathFilename = str_replace("\\","/", $file->getRealPath() ); //Backslash to Slash with Filename $SlashPathFilename = str_replace($dir."/","",$SlashPathFilename); //Change Absolute to Relative Path with Filename $Filename = $file->getFilename(); //Filename Only $SlashPath = str_replace("/".$Filename,"",$SlashPathFilename); //Relative path without Filename //Change the File-Type of the original Document $SlashPathFilenameDocument = $SlashPathFilename; //Prüfen, ob es ein PDF gibt, wenn ja, dann Document link anpassen $SlashPathFilenameDocumentExistsPDF = str_replace(".jpg",".pdf",$SlashPathFilename); if (file_exists($SlashPathFilenameDocumentExistsPDF)) {$SlashPathFilenameDocument = str_replace(".jpg",".pdf",$SlashPathFilename);}; $SlashPathFilenameDocumentExistsMP4 = str_replace(".jpg",".mp4",$SlashPathFilename); if (file_exists($SlashPathFilenameDocumentExistsMP4)) {$SlashPathFilenameDocument = str_replace(".jpg",".mp4",$SlashPathFilename);}; //Output Table if ($i == $Columns) {echo ""; $i++; }; echo "
"; $i = 0;} else {echo "";}; echo ""; echo "".$SlashPathFilenameDocument."
"; echo "
"; echo "
powered by Terragon.de: OnePage-OneFile-PHP-Recursive-Directory-Gallery-Generator-Script

"; ?>