|
Posted by J.O. Aho on 10/03/04 11:33
Ian Rutgers wrote:
> I am creating a page that will display thumbnails of images in a folder. I
> can read the images in the folder but when I try to use the <?
> header("Content-type: image/jpeg");?> ... I get the error message as
> detailed in the subject line.
>
> From what I've researched, it has to do with whitespace on that line ... but
> I don't see any ... help!!!
If you include files, eg
<?PHP
include('file1');
include('file2');
header("Content-type: image/jpeg");
....
?>
Then if there is a whitespace in file1 or in file2, will cause that the
header() comes after the whitespace has been sent. You must look at files that
may be included in the files you have included (file1 and file2), as those do
affect things too.
Don't forget to only look at the top of the file, but at the end of the file
too and of course in between sections where you may break the php.
A method that can lessen the problem with white spaces and such, is to use
ob_start() and ob_end_flush(), then you have only one file to look for white
spaces and such, and ti's the main file.
http://www.php.net/manual/en/function.ob-start.php
http://www.php.net/manual/en/function.ob-end-flush.php
//Aho
[Back to original message]
|