mercredi 27 mai 2020

how to display an image from a directory in PHP?

i'm trying to show a group of images from a local directory and also the size and date of creation i tried this but seem to not work

    <?php
$dir = "./images";
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
        while (($file = readdir($dh)) !== false)
        {
        echo "<img src='/images/$file'>";
        echo date (Y/m/d H: i, filemtime($file));
        echo filesize($file);

        }
        closedir($dh);
    }
}

?>



Aucun commentaire:

Enregistrer un commentaire