I could use some assistance in trying to streamline this jumble of code into maybe a function, or at least slimming this down some.
with this code I am counting the amount of images in a folder (4 folders actually) and then getting that result, and supposedly adding one to it, so therefor when my other code puts an image into that folder it'll be given the new count (so if theres 2 in there, then putting a new fall picture in there would make it fall3, etc)
// this counts the season folders
$fallcnt=0;
$falldirname="images/fall";
$falldn=opendir($falldirname);
while ($dircount=readdir($falldn))
{
$fallcnt=$fallcnt+1;
}
closedir ($falldn);
$fallcount=$fallcnt-1;
$wintercnt=0;
$winterdirname="images/winter";
$winterdn=opendir($winterdirname);
while ($dircount=readdir($winterdn))
{
$wintercnt=$wintercnt+1;
}
closedir ($winterdn);
$wintercount=$wintercnt-1;
$summercnt=0;
$summerdirname="images/summer";
$summerdn=opendir($summerdirname);
while ($dircount=readdir($summerdn))
{
$summercnt=$summercnt+1;
}
closedir ($summerdn);
$summercount=$summercnt-1;
$springcnt=0;
$springdirname="images/spring";
$springdn=opendir($springdirname);
while ($dircount=readdir($springdn))
{
$springcnt=$springcnt+1;
}
closedir ($springdn);
$springcount=$springcnt-1;
// end folder count