Display Images From A Folder

Posted: December 22, 2012 in Php
Tags: ,

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

Courtesy:-http://www.phpmagicbook.com/display-images-from-folder/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s