I once found this code to serve images from my server to a client:
$filename = $_GET["filename"];
if ($filename == null || strlen($filename) < 1){
return null;
}
$fp = fopen($filename, 'rb');
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($filename));
fpassthru($fp);
exit;
When I run this php file through the browser (for example, call this script in the address bar of the browser), the portrait image shows the portrait. But when I run this in an HTML file (I set the element srcelement imgdynamically), all portrait images are displayed as landscape (for example, rotated 90 degrees).
Should I include something in the answer (-headers) that the image is a landscape or a portrait?
So I load the image in html:
document.getElementById('next').src = "image.php?filename=" + data;
This is what the request looks like when called from my html page and when the image is displayed correctly:

And this is the wrong version

, , ? ( , , , )
, , , , , image.jfi, , , ?