Reputation: 15673
I am trying to get a list of paths for all images in a directory. I am using Joomla 2.5 and was wondering if there are some nice API calls that will assist. I know how to code this up in pure PHP, but would rather use built in Joomla! methods - if they exist.
I have had a poke around in the joomla! libraries, but haven't come across much. I was expecting to see some methods in media manager for this, but couldn't see any. Any ideas?
Upvotes: 1
Views: 2878
Reputation: 19743
The Joomla way to do this is the following:
JFolder::files($path, $filter = '.', $recurse, $fullpath , $exclude);
When setting $recurse
to true, also subfolders will be searched. $fullpath
set to true returns the full path in the array. With $exclude
, you can offer an array of extensions, not to include in the search for files. It returns an array with all filenames.
Upvotes: 6