Link to home
Create AccountLog in
Avatar of LouisvilleGeek
LouisvilleGeekFlag for United States of America

asked on

Display recently uploaded images

I am currently working with a web server that has a directory containing images that are uploaded chronologically from a webcam.  My end goal is to have a web page that displays the three most recent images uploaded.  I have attempted to do this with the following code:

$files = glob("imageDirectory/*.*");
for ($i=3; $i<count($files); $i++)
{
	$num = $files[$i];
	print $num."<br />";
	echo '<img height="450px" width="800px" src="'.$num.'" alt="random image" />'."<br /><br />";
}

Open in new window

However instead of displaying three recent images, it shows all of them.  Any advice would be greatly appreciated!
ASKER CERTIFIED SOLUTION
Avatar of LouisvilleGeek
LouisvilleGeek
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of LouisvilleGeek

ASKER

For loop problem.