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 processing too many images in one request, and your images are too large. So the script times out or runs out of memory. And it does so only when it needs to rotate the image, so it is very likely a memory issue. You can check that in your server logs.
Consider resizing your images outside of the upload request, in a queue, processed maybe with a cron.Reply
Consider resizing your images outside of the upload request, in a queue, processed maybe with a cron.