Well, I think you'll find that fopen() on a URL will not succeed if it returns a bad status (such as 404).
Additionally, I think if you try to load an image into GD which isn't a valid JPEG, it will throw an error and fail.
You should of course check for both of these things as they could fail independently.
Your application should really have an error handler which detects any error at any time and causes it to stop rather than using the "charge headlong into oblivion" school of error ignorance.
Mark