Skip to content

Instantly share code, notes, and snippets.

@arvidkahl
Created May 31, 2022 16:48
Show Gist options
  • Save arvidkahl/de07dce636ccfffb43dedb8e12ae3458 to your computer and use it in GitHub Desktop.
Save arvidkahl/de07dce636ccfffb43dedb8e12ae3458 to your computer and use it in GitHub Desktop.
Image Grid List
<doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-black">
<div class="border-8 border-black grid grid-cols-5 gap-2 ">
<?php
$dir = './';
$files1 = scandir($dir);
$indir = array_filter($files1, function($item) {
return ($item[0] !== '.') && (str_contains($item, ".png") || str_contains($item, ".jpeg"));
});
foreach ($indir as &$value) {
echo "<div class-=\"\"><img src=\"$value\" /></div>";
}
?>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment