|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Random Pictures from a directory
Hello All,
Does anyone know how to call random pictures from a directory. I can NOT use my MySQL database because it contains many more records than an individual directory. I want to call up 9 photos on one web page at random. Like each time the page is entered or refreshed? Thanks Ed Plummer Saratoga Springs, NY |
|
#2
|
|||
|
|||
|
RE: Random Pictures from a directory
Well, if you don't want to store the filenames in a database....you can read in the file names from the directory into an array, then shuffle the array, then use the first nine.....
If you already have these in a database, why not just put a where clause on it to limit to that subdirectory? |
|
#3
|
|||
|
|||
|
RE: Random Pictures from a directory
Thanks for the advice Anonymous.
I think the where statement would be very very long to sort out the photos I wanted for the random pictures. I am not sure but I might have to put them in an array, then do as you said anyways. I am not good at this PHP anyway. Just starting out and I have one hell of a job ahead of me in short order. Thanks again, Ed |
|
#5
|
|||
|
|||
|
RE: Random Pictures from a directory
Try this code, just put your images into a directory, enter a few config variables, and you're off:
http://firsttube.com/display.php?file=random_image_generator_v2.php |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Random Pictures from a directory |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|