Selacius Posted March 19, 2006 Share Posted March 19, 2006 Can I make a page where you select which folder you want to view and it displays all files which match a certain criteria (in this case have the file ending *.jpg). Link to comment Share on other sites More sharing options...
dcole.ath.cx Posted March 26, 2006 Share Posted March 26, 2006 Can I make a page where you select which folder you want to view and it displays all files which match a certain criteria (in this case have the file ending *.jpg).<{POST_SNAPBACK}> Here is a script that display images that are located in a folder. <html><head><title>Photos</title></head><body><div style='text-align:center;'><h1>Photos</h1></div><?php$photoDir = "/";$dir = opendir($photoDir);$fileList = null;$fileNo = 0;while(false != ($file = readdir($dir))){ if(($file != ".") and ($file != "..")) { if((strtolower(substr($file, -4)) == ".png") or (strtolower(substr($file, -4)) == ".jpg") or (strtolower(substr($file, -4)) == ".JPG") or (strtolower(substr($file, -4)) == ".bmp") or (strtolower(substr($file, -4)) == ".BMP") or (strtolower(substr($file, -4)) == ".tif") or (strtolower(substr($file, -4)) == ".TIF") or (strtolower(substr($file, -4)) == ".gif") or (strtolower(substr($file, -4)) == ".GIF") or (strtolower(substr($file, -5)) == ".JPEG") or (strtolower(substr($file, -5)) == ".jpeg")) { $fileNo = $fileNo + 1; $filePath = "/$file"; if($fileNo % 2 != 0) { $fileList .= "<tr><td><a href='$filePath' target='_blank'><img src='$filePath' width='200' height='150' alt='$file' border='0' /></a></td>"; } else { $fileList .= "<td><a href='$filePath' target='_blank'><img src='$filePath' width='200' height='150' alt='$file' border='0' /></a></td></tr>"; } } }}closedir($dir);echo("<table border='1' cellspacing='3' cellpadding='3' align='center'>");echo($fileList);echo("</table>");?><center><br></center></form></body></html> Link to comment Share on other sites More sharing options...
real_illusions Posted March 27, 2006 Share Posted March 27, 2006 just tried that script, and it didn't work.just a blank page with the heading "photos" at the top in the middle.and this been the soure code - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><body><div style='text-align:center;'><h1>Photos</h1></div><table border='1' cellspacing='3' cellpadding='3' align='center'></table><center><br></center></form></body></html> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now