PHP Show 1 Image From Directory

Hi there.

The code at the end of this post was created to show every image in a directory /uploads/gloves/ however I only want it to show 1 image instead of every single one. How would I modify the code to suite this?
[php]

<?php $handle = opendir(dirname(realpath(__FILE__)).'/uploads/gloves/'); while($file = readdir($handle)){ if($file !== '.' && $file !== '..'){ echo '
'; } } ?>

[/php]

use a for loop and an if statement.

Sponsor our Newsletter | Privacy Policy | Terms of Service