<!DOCTYPE html>
<html lang="sv">    
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="css/style.css">
    </head>
    <style>
        .gallery-container {
            max-width: 1920px;
            margin: 0 auto;
            display: grid;
            grid-template-columns: repeat(2, minmax(250px, 1fr));
            gap: 15px;
            padding: 20px;
            grid-template-rows: 300px;

            @media screen and (min-width: 1440px) {
                grid-template-columns: repeat(4, minmax(250px, 1fr));
            }

        }
        .gallery-item {
            height: 300px;
            width: auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            p {
                height: 10%;
            }
            img {
                width: 100%;
                height: 90%;
                object-fit: contain;
            }
        }
    </style>
    <body>
        <div class="gallery-container">
            <?php 
            $dir = 'img/';
            $images = glob($dir . "*.{jpg,jpeg,png,gif,webp,svg}", GLOB_BRACE);    
            foreach ($images as $image) {
                echo '<div class="gallery-item">';
                echo '<img src="' . $image . '" alt="Photo">';
                echo '<p>' . $image . '</p>';
                echo '</div>';
            }
            ?>
        </div>
    </body>
</html>