/    Sign up×
Community /Pin to ProfileBookmark

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 :

[code=php]

<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>

[/code]

Thanks!

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @Peuplarchie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...