show random images


Posted on 16th Feb 2014 07:03 pm by admin

hey guys

can someone please suggest a way in which the following code can be edited so it only picks up .jpg files, and so it only shows 20 of them which where found, in a randomized order

Did you know?Explore Trending and Topic pages for more stories like this.
Code: <?php
$files = new RecursiveDirectoryIterator("./gallery");
foreach(new RecursiveIteratorIterator($files) as $files)
{
$file = basename($files);
echo ''.$file.'<br/>';
}
?>


thanks everyone
No comments posted yet

Your Answer:

Login to answer
190 Like 39 Dislike
Previous forums Next forums
Other forums

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

Stats of viewers
Hello. I have a website in php and people can login. I want to make an admin control panel where u c

Database/Table Collation
What is the Database, and table collations used for? i don't understand what there used for since co

Encrypt php code?
Is it possible to encrypt php code in files,
so that it displays a load of unreadable characters

Database connection failure
Hello All,

I am trying to create new connection to Oracle DB 10.1,
I could not see a

Need help adding a timestamp to my filename/variable
Hello,

I'm kind of stupid when it comes to php and I need a tiny bit of help. I've got a f

default SAP userid
hi,, I just like to know if it is ok to use the default SAP user id (SAP*)?

error with opendir
when i do this

if ($handle = opendir($dir)) {
while (false !== ($file = readdir($han

please help
HTML Code:

Code: <span id="ctl00"><span>

captcha error
I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash