How can the quality of thumbnails created with the GD library be improved in PHP?

When creating thumbnails with the GD library in PHP, the quality can be improved by using the `imagecopyresampled()` function instead of `imagecopyresized()`. This function provides better image quality by using interpolation to create a smoother result.

// Load the original image
$original_image = imagecreatefromjpeg('original.jpg');

// Create a new image with the desired dimensions for the thumbnail
$thumbnail = imagecreatetruecolor($new_width, $new_height);

// Copy and resize the original image to the thumbnail with improved quality
imagecopyresampled($thumbnail, $original_image, 0, 0, 0, 0, $new_width, $new_height, $original_width, $original_height);

// Save the thumbnail image
imagejpeg($thumbnail, 'thumbnail.jpg');

// Free up memory
imagedestroy($original_image);
imagedestroy($thumbnail);