Peuplarchie Posted April 22, 2009 Share Posted April 22, 2009 Good day to you all, I was wondering how to seperate the result of a direcory read. Example, I know the files will be images. How can I show the portrait first and then landscape second ? here is my code : <html> <head> <SCRIPT language="JavaScript"> <!-- if (document.images) { preload_image = new Image(25,25); <?PHP // directory name sent by url $dir = $_GET['dir']; $file = $_GET['file']; //define the path as relative $path = $dir."".$file; //using the opendir function $dir_handle = @opendir($path) or die("Unable to open $path"); echo "Directory Listing of $path<br/>"; //running the while loop while ($file = readdir($dir_handle)) { if($file!="." && $file!="..") echo "preload_image.src=\"http://test.peuplies.info/PHP/Photos_gallery/".$path."/".$file.""; } echo "} //-> </script> </head> <body><center>"; while ($file = readdir($dir_handle)) { if($file!="." && $file!="..") echo "<img src=\"".$path."/".$file."\" width=\"50px\">"; } //closing the directory closedir($dir_handle); ?> </center> </body> </html> Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/155127-seperate-directory-reading/ Share on other sites More sharing options...
Maq Posted April 22, 2009 Share Posted April 22, 2009 And your question is? PS - Use tags around code please, thx. Quote Link to comment https://forums.phpfreaks.com/topic/155127-seperate-directory-reading/#findComment-816020 Share on other sites More sharing options...
Peuplarchie Posted April 22, 2009 Author Share Posted April 22, 2009 here... Quote Link to comment https://forums.phpfreaks.com/topic/155127-seperate-directory-reading/#findComment-816021 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.