Created
May 31, 2022 16:48
-
-
Save arvidkahl/de07dce636ccfffb43dedb8e12ae3458 to your computer and use it in GitHub Desktop.
Image Grid List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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