04-22-2009, 12:39 AM
|
#1 (permalink)
|
|
The Acquainted
Join Date: May 2008
Location: Québec
Posts: 103
Thanks: 10
|
Seperate directory reading
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 :
PHP 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!
__________________
That's why we are not alone on earth... let's build !
|
|
|
|