What are common errors related to modifying header information in PHP when trying to display images from a folder?
When trying to display images from a folder in PHP, a common error related to modifying header information is the "Cannot modify header information - headers already sent" error. This error occurs when there is whitespace or output before the headers are set, which can prevent the image from being displayed properly. To solve this issue, ensure that there is no whitespace or output before setting the header information.
<?php
header('Content-Type: image/jpeg');
$image = 'path/to/image.jpg';
readfile($image);
?>