Ahh... the problem is with the $extension variable being generated that depends on it being only 3 characters. Here is a better regex way to cheeck for any image. The other problem I could see with the file still not being listed is that the file extension is not in all lower case. It does matter on a Linux/Unix box.
Here is my suggestion again... replace this line
if ($file != "." && $file != ".." && ($extension == ".jpg" || $extension == ".jpeg")) {
with
if (eregi ("(.)+\\.(jp(e){0,1}g$|gif$|png$)",$file)){
You can delete the line that tries to create the extension, it is not needed any longer.
To add that delete feature would take quite a bit of re-coding of the script, it's not a one or two liner. However, I can try to point you in the right direction. First, replace this line:
<td bgcolor=336699><a href=\"$file\"><font color=white>$file (".fsize($file).")</font></a></td>
with
<td bgcolor=336699><a href=\"$file\"><font color=white>$file (".fsize($file).")</font></a> <a href=\"delete_image.php?filename=$file\" onClick=\"return confirm('Are you sure you want to delete this file?')\">(delete)</a></td>
Then create a new php called delete_image.php that takes the filename (it will be in $_GET["filename"]) and removes it.
Have fun...