|
Posted by Ian Rutgers on 10/10/57 11:33
"J.O. Aho" <user@example.net> wrote in message
news:3v8k41F14kab1U1@individual.net...
> 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
Thanks to everyone for your replies! It turns out I don't need
"header('Content-type: image/jpeg');" as I am not doing any processing and
returning of bytes stream of image data. So I removed the line ... tested
and all works well.
Navigation:
[Reply to this message]
|