I have a gallery that is generated from a directory with php.
I'd like to show only 2 rows of 4 images each, so a total of 8 images. There would be a "show more" button at the bottom.
When the user would click the button then 2 more rows would load.
How can I limit the number of rows?
Would jQuery be the way to go?
<div class="w3-content w3-container w3-padding-64" style="margin-top:50px;">
<h3 class="w3-center w3-text-white">Never Ending Light of Day</h3>
<br>
<!-- Responsive Grid. Four columns on tablets, laptops and desktops. Will stack on mobile devices/small screens (100% width) -->
<div class="w3-row-padding w3-center">
<?php
// Find all files in that folder
$files = glob('uploads/*');
// Do a natural case insensitive sort, usually 1.jpg and 10.jpg would come next to each other with a regular sort
natcasesort($files);
// Display images
foreach($files as $file) {
echo '<div class="w3-col m3"><img src="' . $file . '" style="width:100%" onclick="onClick(this)" class="w3-hover-opacity"/></div>';
}
?>
</div>
</div>
</div>