Hi,
The getimagesize error is probably the result of the filename you pass to the function: I think you only pass the name of the file, whereas you should be passing the full filepath&name, since the script does not know in which folder on the server you are working. The headers already sent is a result of the first error message.
But even then i will not work. The resize you do, will generate an image stream, I think. This you will either have to show as an image directly, in an html tag like so:
<img src="YourScriptName.php">
Or you should save the file on your filesystem.
One file cannot output more then one filetype. So either an HTML document, OR and image.
So: The script cannot be used to show a list of thumbs directly, without saving the thumbs. You need to either split the script: One file to list the image names in <img ..> tags, and one to create the image streams, or you have to save each thumb as you create it on the filesystem, and echo out the <img src> tags to the thumbnail files.