[PHP] Am I dreaming or what :)

2003-09-04 Thread John Taylor-Johnston
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:

Re: [PHP] Am I dreaming or what :)

2003-09-04 Thread Raditha Dissanayake
this is in fact pretty easy. this should get you started [code] $files = split(\n,`ls *gif`); srand((double)microtime()*100); $num = rand(0, count($files)); echo $num = $files[$num]; [/code] John Taylor-Johnston wrote: I have a directory jammed-packed with images. I want to

Re: [PHP] Am I dreaming or what :)

2003-09-04 Thread Evan Nemerson
Watch out for line wraps. ?php /* I wrote this for private use, so don't be suprised if it sucks. */ $DIRECTORY = '/path/to/images'; $PATH_ROOT = $DIRECTORY; // Kind of a document root for this script. if ( isset($_SERVER['PATH_INFO']) file_exists($DIRECTORY.$_SERVER['PATH_INFO'])

RE: [PHP] Am I dreaming or what :)

2003-09-04 Thread Dynamical.biz
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

Re: [PHP] Am I dreaming or what :)

2003-09-04 Thread John Taylor-Johnston
But how do i get $files ? thanks :) John Raditha Dissanayake wrote: this is in fact pretty easy. this should get you started [code] $files = split(\n,`ls *gif`); srand((double)microtime()*100); $num = rand(0, count($files)); echo $num = $files[$num]; [/code] John

RE: [PHP] Am I dreaming or what :)

2003-09-04 Thread Chris W. Parker
John Taylor-Johnston mailto:[EMAIL PROTECTED] on Thursday, September 04, 2003 4:57 PM said: But how do i get $files ? What do you mean get $files? This line right here: $files = split(\n,`ls *gif`); get's $files. Try print_r($files); and see what happens. Chris. thanks :)