Link to home
Start Free TrialLog in
Avatar of gvilla23
gvilla23Flag for United States of America

asked on

count number of .jpg's in a directory, sort in array to create links

I need to count number of images (.jpg) in a folder, sort them by name so I can dynamically create next and previous buttons in a gallery carousel.
Avatar of Vampireofdarkness
Vampireofdarkness
Flag of United Kingdom of Great Britain and Northern Ireland image

A nudge in the right direction would be opendir(): http://php.net/manual/en/function.opendir.php

You can traverse the folder to get the document names and types, separate only the jpg files into an array then do whatever else you want to do.
ASKER CERTIFIED SOLUTION
Avatar of sbickerstaff
sbickerstaff
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
just noticed, that should be
$piccount++;
not
$piclist++;

thanks.