What are the potential issues with using different file extensions (.jpg vs .jpeg) when displaying images in PHP?

Using different file extensions (.jpg vs .jpeg) can lead to inconsistencies in displaying images in PHP, as some servers may not recognize both extensions. To ensure compatibility, it is recommended to stick to a single file extension for all images. One way to solve this issue is by using the `pathinfo` function in PHP to extract the file extension from the image file name and then using that extension to display the image.

$image_path = 'image.jpg';
$image_info = pathinfo($image_path);
$image_extension = $image_info['extension'];

// Display the image using the extracted file extension
echo '<img src="' . $image_path . '" alt="Image" />';