Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: Images in differents directories
klod
Junior Member

Posts: 2
Registered: 5/5/2008
Member Is Offline
posted on 5/5/2008 at 09:07 PM Reply With Quote
Images in differents directories


Hi,

Thanks for your script. I think that I will use the php one (4th in your examples). Just a question on scanning differents directories.
The script says :
Code:
$s_path = 'img/';

I try to amend it in following ways, but it does not work
Code:
$s_path = array ('img1/', 'img2/');

I'm not a PHP expert, so if you have a solution, it will be great :)
Yours,
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 5/6/2008 at 02:05 PM Reply With Quote

if you're replacing the string with the array of strings then you should add the loop to make script go through all the elements of the array. Here's the modified code from the top of the head (not tested):

Code:

$a_paths = array ('img1/', 'img2/');
$a_types = array ('jpg', 'gif', 'jpeg', 'png');
$a_images = array ();
foreach ($a_paths as $s_path) {
$h_dir = opendir($s_path);
while ($s_file = readdir($h_dir)) {
$s_type = strtolower(substr(strrchr($s_file, '.'), 1));
if (in_array($s_type, $a_types))
array_push($a_images, "\n\t\t'$s_path$s_file'");
}
closedir($h_dir);
}
sort($a_images);
echo join(',', $a_images);
View User's Profile View All Posts By User U2U Member
klod
Junior Member

Posts: 2
Registered: 5/5/2008
Member Is Offline
posted on 5/6/2008 at 06:55 PM Reply With Quote

Hi,

Thanks, it's working very well :)
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Page Live Demos
Product Page Simple Slide Show
Product Page Multiple Slide Shows
Product Page Methods and Properties
Free Script Download Free Download
Product Documentation Documentation
Support Forum Support Forum
 

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004