this is the way I do if helps //FILES IN DIR TO ARRAY $imgdir = "user/home/"; $lista_imgs = array(); $handle = opendir($imgdir); while ($file = readdir($handle)) {if ($file != "." && $file != "..") {array_push ($lista_imgs, $file);}} closedir($handle);
// RANDOM IMG $rdnum = rand(0, count($lista_imgs) - 1); $img_home = $lista_imgs[$rdnum]; I assume there are only GIF or JPG files in the directory saludos aniceto lopez :: DYNAMICAL.BIZ web development & host services Barcelona - Spain -----Mensaje original----- De: John Taylor-Johnston [mailto:[EMAIL PROTECTED] Enviado el: jueves, 04 de septiembre de 2003 8:07 Para: [EMAIL PROTECTED] Asunto: [PHP] Am I dreaming or what :) I have a directory jammed-packed with images. I want to read the directory contents /www/usr/htm/images/ and display randomly any *.gif or *.jpg in said directory. Do-able? Seriously? Ideas? Places to start? John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php