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

problem getting my contact form working
Yeah I know this is a pretty basic problem, but it's been a while since I've worked with PHP and I'm

question about n
I was looking at some of the things you could do with php and one of the things I have tried is n.<

user data not transferring to new page
I'm a PHP learner. After an index.php page, the user goes to a login.php page. Both pages seem to

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

function not returning the correct value
I have a program that needs to return a value from a function. I have an output statement inside the

Is there a way to override built in php functions without APD?
I am trying to use the
rename_function()
override_function()
options that are built into

Accessing element of object array
Hello

My object looks like this:


Array ( [0] => User Object ( [id] =>

PHP Session Issue
I'm having an issue with one section on my website dealing with sessions. Now I know that myself and

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

SQL query not working well
Hi,
I made a small table with 5 rows and want to make them an sql consult using rownum

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