"." && $filename<>".." ) { // Name your screenshot the same name as the folder. Or change it... if( file_exists("./$filename/$filename.png") ) { $screenshot = "./$filename/$filename.png"; } else { $screenshot = './default.png'; } echo "