Aleksandar-Mitic
8/21/2018 - 6:03 AM

Display Images From A Folder with PHP

Display Images From A Folder with PHP

//Using lightbox

                   <!-- Start VisualLightBox.com HEAD section -->
            <link rel="stylesheet" href="engine/css/vlightbox1.css" type="text/css" />
            <link rel="stylesheet" href="engine/css/visuallightbox.css" type="text/css" media="screen" />
            <script src="engine/js/visuallightbox.js" type="text/javascript"></script>
            <script src="engine/js/vlbdata.js" type="text/javascript"></script>
            <!-- End VisualLightBox.com HEAD section -->
</head>

<body>

....

<div id="vlightbox1">
<?php
$thumbs = glob("data/facepainting_thumbs/*.*");
$images = glob("data/facepainting_images/*.*");
for ($i=1; $i<count($thumbs); $i++)
{
$numT = $thumbs[$i];
$numI = $images[$i];
echo '<a class="vlightbox1" href="'.$numI.'" title="'.$i.'"><img src="'.$numT.'"/></a>';
}
?>
</div> 

....
//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 A Folder with PHP

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