What are some best practices for handling errors in PHP image manipulation?

When handling errors in PHP image manipulation, it is important to check for errors after each image manipulation function call and handle them appropriately. One common practice is to use the `try` and `catch` blocks to catch exceptions thrown by functions that manipulate images.

try {
    // Image manipulation code here
} catch (Exception $e) {
    // Handle the error, log it, or display an error message
    echo 'Error: ' . $e->getMessage();
}