//request the name of the folder to open, e.g. http://www.yourdomain.com/gallery.php?n=artworkfolder
$foldername = $_REQUEST['images'];
//Set the directory as the name read in from the url
$directory = dir("$foldername");
//Set the filepath for the images as your domanin name + the name of the folder you want to pull the images from i.e. http://www.yourdomain.com/artworkfolder/
$pic_filepath = "http://images.energieportal24.de/$foldername/"; //change the domain name here to yours..
//specify the valid name extensions, i.e. the folder could contain other non image files which we don't want to display. You could change this to only load music files for example e.g. array (".mid",".wav",".mp3")
$valid_formats = array (".jpg",".gif",".JPG",".bmp");
//now do the loop & read the contents of the directory, keep going until everything has been read
while (false !== ($current_file = $directory->read()))
{
//set the filepath of the file currently being read to directory/filename
$pic_filepath = "$foldername/$current_file";
//convert the filename to lowercase so we can check to see if the file is in a valid format i.e. is it an image
$current_file = strtolower($current_file);
//grab the file extension by cutting off anything before the . in the filename
$filetype = strstr($current_file, '.');
//check if the file is in the correct format
if (in_array($filetype, $valid_formats))
{
//print the image to the screen as a 50x50 thumbnail (grand if you have plenty of bandwidth like me) with a link to the full size image opening a new browser window
echo "
$pic_filepath