Post: How can my website find how many files are in a certain directory?
05-27-2011, 03:36 PM #1
anddrew
League Champion
(adsbygoogle = window.adsbygoogle || []).push({}); It is so that the website shows the latest picture.
cheerrrs babes :mudkip:
(adsbygoogle = window.adsbygoogle || []).push({});
05-27-2011, 03:39 PM #2
<Jimbo>
</Jimbo>
Are the pictures uploaded alphabetically?

Originally posted by anddrew View Post
It is so that the website shows the latest picture.
cheerrrs babes :mudkip:

The following user thanked <Jimbo> for this useful post:

anddrew
05-27-2011, 03:45 PM #3
anddrew
League Champion
Originally posted by Jimbo View Post
Are the pictures uploaded alphabetically?


no, numerical.

Got a code:
    
<?PHP

$directory = "https://www.nextgenupdate.com/forums/images/";
if (glob("$directory*.jpg") != false)
{
$filecount = count(glob("$directory*.jpg"));
echo $filecount;
}
else
{
echo 0;
};

?>
sorry I got it :/

now I need to load the image using the variable " $filecount "

would this work?
    <img src="https://www.nextgenupdate.com/forums/images/$filecount.jpg" /> 
(I do not know why the ngu website keeps coming up...
try again:
<img src="images/$filecount.jpg" />
05-27-2011, 03:56 PM #4
<Jimbo>
</Jimbo>
Yeah, if you were to use that it'd be...

    <img src="images/'.$filecount.'">
If yours doesn't work :p

The following user thanked <Jimbo> for this useful post:

anddrew

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo