PHP Magic Book – Free PHP Scripts, Tutorials and Downloads, PHP AtoZ Reloaded, free php tutorials, free php downloads, php scripts, PHP tips

Auto Display Images From Folder Using PHP

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

  • Share/Bookmark
Tags: ,
Posted in: File, Image Galleries, Image Galleries II, Image Handling, Scripts
Post's RSS » RSS 2.0
Post's Comments RSS » RSS 2.0

Related Posts




2 Responses to “Auto Display Images From Folder Using PHP”

  1. Sep 17, 2009
    me Says:

    thnx, it worked! I did set the i=1 to 1=0 to display all the images ;-)

  2. Jan 6, 2010
    cm17 Says:

    thank..

Post a Comment

  Subscribe Via RSS
  Subscribe Via Email