PHP script - easy customization request?

PASK

New member
I've found the following PHP script on the web. It displays all files in the current folder.

However, I only want to display a specific filetype, eg JPG.

Is there a quick fix for this?
Thanks for any help!

<?php
$handle = opendir ('./');
while (false !== ($file = readdir($handle))) {
if($file != "." && $file != ".." && $file != basename(__FILE__)) {
echo '<img src="'.$file.'"/>'.'<br>'.substr($file,0,-4).'<br>'.'<br>'.'';
}
}
?>
 
Back
Top