class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
You are in fact running out of memory. The fix you added is not good, because it relies on your memory setting, and will not be appropriate for other configurations.
On the same php.net page, read the second comment above the one you mentioned.
See this thread
Try to raise your local memory to 20M, 32M or more.
You can add this in your script:
Or in a .htaccess file: