PDA

View Full Version : Small PHP Code Needed



jack-bristol
28-11-2009, 11:05 AM
I am looking for a small bit of php code which counts the number of jpg, png, gif and bmp files in a directory and outputs the answer in 1 number.

+rep for anyone who can help.

PatrickMS
28-11-2009, 03:14 PM
I am looking for a small bit of php code which counts the number of jpg, png, gif and bmp files in a directory and outputs the answer in 1 number.

+rep for anyone who can help.



<?php
$directory = "gallery/images/";
$filecount = count(glob("" . $directory . "*.*"));
echo "Images in Gallery: $filecount";
?>


That will say how many files are in a folder...

Gl

jack-bristol
28-11-2009, 03:17 PM
Thanks :P +rep

Want to hide these adverts? Register an account for free!