What are common issues when using GD-Lib in PHP and how can they be resolved?

Issue: One common issue when using GD-Lib in PHP is that the images created may not display correctly due to missing image headers. This can be resolved by setting the correct content-type header before outputting the image.

// Set the content-type header before outputting the image
header('Content-Type: image/png');

// Create and output the image
$image = imagecreatetruecolor(200, 200);
imagepng($image);
imagedestroy($image);