[ELECTRON] PHP - question. . . webcam script...

Mark Bryars electronclub at darkskiez.co.uk
Sat Apr 3 23:45:25 UTC 2010


You probably don't have errors suppressed, and the fopen to test if the
camera is there is failing and printing an error, which generates
output, which means you cant send any headers.

prefix the fopen with an @ sign

if (@fopen($img_remote, "r")== true ) 


Regards,
 Mark

Ben Rush wrote:
> Gordon,
>
> Thanks for taking a look at this - I got the sense that an something
> was firing off before it should. I've yet to break away from family
> obligations this weekend, but I have managed to post the code to paste
> bin: http://pastebin.com/rrC86Zdj
>
> happy Easter everyone - cracking day out today, spent it fishing for
> sculpture bits out of the graving docs in Govan -- good times!
>
> Ben
>
>
> On 3 April 2010 20:43, Gordon JC Pearce <gordonjcp at gjcp.net> wrote:
>   
>> On Sat, 2010-04-03 at 00:15 +0100, Ben Rush wrote:
>>     
>>> Hello folks,
>>> Im going to preface this by stating I'm a self described noob, so if
>>> this seems elementary - I stand by my assertion.
>>> I have come to a block and Im not sure how to deal with it, and any
>>> thought would be amazing.
>>>
>>> Im working on a fetch image script for a webcam and everything seemed
>>> hunky-dorry.
>>>
>>> I later decided to add an if/else on the off chance the camera wasn't
>>> available. This is where things got confusing.
>>>
>>> If the camera fails I get a "Warning: Cannot modify header
>>> information". The thing is I cant figure out were the header info is
>>> being declared, as the warning seem to indicate that the declaration
>>> comes from in the 'if' statement itself. Wait didn't that just fail?!?
>>>       
>> Something is outputting stuff to the server before you get a chance to
>> send the header() part.
>>
>> A quick demonstration - type "telnet www.electronclub.org 80"
>> Once you get the "Escape character is '^]'." message type
>> "GET / HTTP/1.0" then <RETURN> <RETURN>
>>
>> You'll see the server's response - "HTTP/1.1 200 OK" and a bunch of
>> things like "Date:" and "Length:" and importantly "Content-Type:".
>> These are the headers.  There's a blank line before the actual content
>> *and this is very important*.
>> Once you send that blank line, you cannot send any more headers.
>>
>>     
>>> Moving the 'header('content-type: image/jpg');' higher up in the
>>> script doesn't seem to fix it. Moving it before the if statement all
>>> together gives a broken image link - the echo of file contents don't
>>> seem to make to the browser.
>>>
>>> I also checked to see if there was any empty space before or after my
>>> <? ?> - no empty echoes there either. .
>>>       
>> Can you put the script up in something like pastebin, with line numbers?
>> That would make it a wee bit easier to trace.
>>
>> Gordon MM0YEQ
>>
>>
>> _______________________________________________
>> members mailing list
>> members at electronclub.org
>> http://lists.electronclub.org/cgi-bin/mailman/listinfo/members
>>
>> Instructions for changing your mailing list settings:
>> http://lists.electronclub.org/emailhowto.html
>>
>>     
>
> _______________________________________________
> members mailing list
> members at electronclub.org
> http://lists.electronclub.org/cgi-bin/mailman/listinfo/members
>
> Instructions for changing your mailing list settings:
> http://lists.electronclub.org/emailhowto.html
>   




More information about the members mailing list