What is the common error message encountered when trying to add an image to a PDF using fpdf in PHP?

When trying to add an image to a PDF using fpdf in PHP, a common error message encountered is "FPDF error: Unsupported image type: jpg". This error occurs when the image format is not supported by fpdf. To solve this issue, make sure to convert the image to a supported format such as PNG before adding it to the PDF.

<?php
require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();

// Convert JPG image to PNG
$image = imagecreatefromjpeg('image.jpg');
imagepng($image, 'image.png');
imagedestroy($image);

// Add PNG image to PDF
$pdf->Image('image.png', 10, 10, 50, 0, 'PNG');

$pdf->Output();
?>