image count in a directory
Posted: Sat Feb 04, 2006 5:38 pm
I need to show the count of imnages in a specific directory, I have this code below but it only shows
.JPG
I need to add ability to count images with
.jpg
.PNG
.png
.gif
.GIF
any help appreciated
.JPG
I need to add ability to count images with
.jpg
.PNG
.png
.gif
.GIF
any help appreciated
Code: Select all
<?php
$my_jpg_counter=0;
$d = dir($my_dir = "../signs/tobeapproved");
while (false !== ($entry = $d->read())) {
$ext = strrchr($entry, ".");
if($ext == ".JPG")
$my_jpg_counter++;
}
$d->close();
echo "<font color=\"0270CA\" face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"3\"><strong>(<font color=\"000000\">$my_jpg_counter</font>)</strong></font>";
?>