I need to display images from a directory. Currently, two blank images are displayed first before my images are shown.
I was told to put the condition if($files>2)
, and it seemed to be working
<?php
$dir="imagesbu";
$files=scandir($dir);
if($files)
{
?>
<div class="row">
<?php
foreach($files as $file)
{
?>
<div class="col s6 m3 l3">
<div class="card" style="height:100px; width:150px;">
<div class="card-image">
<img src="imagesbu/<?php echo $file;?>" alt="" style="height:100px;
width:150px;" >
</div>
</div>
</div>
<?php
}
}
?>
</div>