Auto Display Images From Folder Using PHP

by Hiroshi on June 18, 2008

in File, Image Galleries, Image Galleries II, Image Handling, Scripts

Save photos in a folder named as ‘images’ and use these scripts to display all photos in a fly.

Display Images From A Folder

<?php
$files = glob("images/*.*");
for ($i=1; $i<count($files); $i++)
{
	$num = $files[$i];
	echo '<img src="'.$num.'" alt="random image">'."&nbsp;&nbsp;";
	}
?>

Display Images With Image Name From A Folder

<?php
$files = glob("images/*.*");
for ($i=1; $i<count($files); $i++)
{
	$num = $files[$i];
	print $num."<br />";
	echo '<img src="'.$num.'" alt="random image" />'."<br /><br />";
}
?>

Display Images From Folder Script Download

Related Posts

Previous post:

Next post: