I have a folder with a lot of .jpg picture files. I would like to acees one or two files at runtime randomly. Please tell me how should I make it.
Printable View
I have a folder with a lot of .jpg picture files. I would like to acees one or two files at runtime randomly. Please tell me how should I make it.
Use any directory reading method (see the PHP reference) to collect the names of all files into an array. Then use any random method (again, see the PHP reference: for example, there's a method for arrays that chooses n random entries) to select random entries.
The picture in my signature does that with only one picture ata time. however, you can use PHP's Image functions to moasic two toghether.
http://adam.codedv.com/random/random.php?source