-
-
Save ilyasozkurt/36a168c9850303765d21478d8288e6fc to your computer and use it in GitHub Desktop.
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 | |
$iterator = new DirectoryIterator('images/'); | |
foreach ($iterator as $fileinfo) { | |
if ($fileinfo->isFile()) { | |
$extension = strtolower($fileinfo->getExtension()); | |
if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'svg', 'webp'])) { | |
echo '<img src="images/' . $fileinfo->getFilename() . '" />'; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment