I have the following code that reads image.jpg from a folder, but despite adding the (assumed) correct header AND checking correct MIME is set on IIS, it displays code rather than showing the image.
<?php
// open the file in a binary mode
$name = 'image.jpg';
$fp = fopen($name, 'rb');
// send the right headers
header("Content-Type: image/jpeg");
header("Content-Length: " . filesize($name));
// dump the picture and stop the script
fpassthru($fp);
exit;
?>
Displays code :
����JFIFHH��C��C����"��