I have the following script (see below) which should read an image file, send the correct headers and output it all to the browser. Pretty easy one would think. The script works fine when run on Apache on Linux, but outputs the image in a very strange manner on windows. Dunno why, dunno what I can do about it... Any idea ?
The working script and the image I used for testing (idem for other images, tried that!) can be found on www.remind.be/testimage.php (linux box so runs fine)
<?php
$disposition = "inline"; // "inline" to view file in browser or "attachment" to download to hard disk
$mime = "image/jpeg"; // or whatever the mime type is
$name = "testimage.jpg"; // file name
$path = $name;
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: $mime");
header("Content-Disposition:$disposition; filename=\"".trim(htmlentities($name))."\"");
header("Content-Description: ".trim(htmlentities($name)));
header("Content-Length: ".(string)(filesize($path)));
header("Connection: close");
$fp = fopen ($name, "rb");
fpassthru($fp);
fclose($fp);
?>