Created
April 7, 2020 13:16
-
-
Save eurowebpage/6676610ecd5bf72b4ec03f3d7a857f5d to your computer and use it in GitHub Desktop.
afficher-toutes-les-images-choix-extension-et-nom
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
<?php | |
//$files = glob("images/*.*"); | |
$files = glob("img/*.*"); | |
for ($i=0; $i<count($files); $i++) | |
{ | |
$image = $files[$i]; | |
$supported_file = array( | |
'gif', | |
'jpg', | |
'jpeg', | |
'png' | |
); | |
$ext = strtolower(pathinfo($image, PATHINFO_EXTENSION)); | |
if (in_array($ext, $supported_file)) { | |
echo basename($image)."<br />"; // show only image name if you want to show full path then use this code // echo $image."<br />"; | |
echo '<img src="'.$image.'" class="img-fluid" />'; | |
} else { | |
continue; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment