I did find this but, it gives me this error:
undefined function: scandir()
$image_dir = "./images/";
// make the image name safe
$image_name = stripslashes( $_GET['img'] );
// get all images in the image dir
$images = scandir($image_dir);
// chop of "." and ".." from the images array
$images = array_slice( $images, 2 );
// if the file doesn't exist die()
if( array_search( $image_name, $images ) === FALSE ) die("<b>Error: </b> Image Not Found!");
// get the contents of the image
$image_contents = file_get_contents( $image_dir . $image_name );
// site mime content-type to whatever the image type is
header("Content-Type: ". mime_content_type( $image_dir . $image_name ) );
// get the image contents
$image_contents = file_get_contents( $image_dir . $image_name );
// display the image
echo $image_contents;